home *** CD-ROM | disk | FTP | other *** search
/ Super PC 34 / Super PC 34 (Shareware).iso / spc / UTIL / DJGPP2 / V2 / DJDEV200.ZIP / info / libc.inf < prev    next >
Encoding:
GNU Info File  |  1996-02-05  |  497.4 KB  |  22,974 lines

  1. This is Info file ../../info/libc.inf, produced by Makeinfo-1.63 from
  2. the input file libc.tex.
  3.  
  4. This is the reference manual for libc.a
  5.  
  6. Copyright (c) 1996 DJ Delorie
  7.  
  8. 
  9. File: libc,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
  10.  
  11. * Menu:
  12.  
  13. * Introduction::
  14.  
  15. * Functional Categories::  All public symbols listed by
  16.                            category
  17.  
  18. * Alphabetical List::      All public symbols in alphabetical
  19.                            order
  20.  
  21. * Index::
  22.  
  23. 
  24. File: libc,  Node: Introduction,  Next: Functional Categories,  Prev: Top,  Up: Top
  25.  
  26. Introduction
  27. ************
  28.  
  29. The standard C library, `libc.a', is automatically linked into your
  30. programs by the `gcc' control program.  It provides many of the
  31. functions that are normally associated with C programs.  This document
  32. gives the proper usage information about each of the functions and
  33. variables found in `libc.a'.
  34.  
  35. For each function or variable that the library provides, the definition
  36. of that symbol will include information on which header files to include
  37. in your source to obtain prototypes and type definitions relevent to the
  38. use of that symbol.
  39.  
  40. Note that many of the functions in `libm.a' (the math library) are
  41. defined in `math.h' but are not present in libc.a.  Some are, which may
  42. get confusing, but the rule of thumb is this - the C library contains
  43. those functions that ANSI dictates must exist, so that you don't need
  44. the `-lm' if you only use ANSI functions.  These functions are,
  45. however, vastly simplified compared to the ANSI spec and the functions
  46. in `libm.a', which includes replacements.  For example, `libc.a''s
  47. `ldexp()' doesn't set `errno' on error, but `libm.a''s `ldexp()' does.
  48.  
  49. 
  50. File: libc,  Node: Functional Categories,  Next: Alphabetical List,  Prev: Introduction,  Up: Top
  51.  
  52. Functional Categories
  53. *********************
  54.  
  55. * Menu:
  56.  
  57. * bios functions::
  58. * conio functions::
  59. * cpu functions::
  60. * ctype functions::
  61. * dos functions::
  62. * dpmi functions::
  63. * environment functions::
  64. * file system functions::
  65. * go32 functions::
  66. * io functions::
  67. * locale functions::
  68. * math functions::
  69. * memory functions::
  70. * misc functions::
  71. * mono functions::
  72. * posix functions::
  73. * process functions::
  74. * random number functions::
  75. * shell functions::
  76. * signal functions::
  77. * sound functions::
  78. * startup functions::
  79. * stdio functions::
  80. * stdlib functions::
  81. * string functions::
  82. * time functions::
  83. * unix functions::
  84.  
  85. 
  86. File: libc,  Node: bios functions,  Next: conio functions,  Up: Functional Categories
  87.  
  88. bios functions
  89. ==============
  90.  
  91. * Menu:
  92.  
  93. * _bios_disk::
  94. * _bios_equiplist::
  95. * _bios_keybrd::
  96. * _bios_memsize::
  97. * _bios_printer::
  98. * _bios_serialcom::
  99. * _bios_timeofday::
  100. * bioscom::
  101. * biosdisk::
  102. * biosequip::
  103. * bioskey::
  104. * biosmemory::
  105. * biosprint::
  106. * biostime::
  107. * getkey::
  108. * getxkey::
  109. * kbhit::
  110.  
  111. 
  112. File: libc,  Node: conio functions,  Next: cpu functions,  Prev: bios functions,  Up: Functional Categories
  113.  
  114. conio functions
  115. ===============
  116.  
  117. * Menu:
  118.  
  119. * cgets::
  120. * clreol::
  121. * clrscr::
  122. * _conio_kbhit::
  123. * cprintf::
  124. * cputs::
  125. * cscanf::
  126. * delline::
  127. * getch::
  128. * getche::
  129. * gettext::
  130. * gettextinfo::
  131. * gotoxy::
  132. * gppconio_init::
  133. * highvideo::
  134. * insline::
  135. * lowvideo::
  136. * movetext::
  137. * normvideo::
  138. * putch::
  139. * puttext::
  140. * Screen Variables::
  141. * ScreenClear::
  142. * ScreenCols::
  143. * ScreenGetCursor::
  144. * ScreenMode::
  145. * ScreenPutChar::
  146. * ScreenPutString::
  147. * ScreenRetrieve::
  148. * ScreenRows::
  149. * ScreenSetCursor::
  150. * ScreenUpdate::
  151. * ScreenUpdateLine::
  152. * ScreenVisualBell::
  153. * _set_screen_lines::
  154. * _setcursortype::
  155. * textattr::
  156. * textbackground::
  157. * textcolor::
  158. * textmode::
  159. * ungetch::
  160. * wherex::
  161. * wherey::
  162. * window::
  163.  
  164. 
  165. File: libc,  Node: cpu functions,  Next: ctype functions,  Prev: conio functions,  Up: Functional Categories
  166.  
  167. cpu functions
  168. =============
  169.  
  170. * Menu:
  171.  
  172. * _clear87::
  173. * _control87::
  174. * disable::
  175. * enable::
  176. * _fpreset::
  177. * htonl::
  178. * htons::
  179. * inb::
  180. * inp::
  181. * inportb::
  182. * inportl::
  183. * inportsb::
  184. * inportsl::
  185. * inportsw::
  186. * inportw::
  187. * inpw::
  188. * _my_cs::
  189. * _my_ds::
  190. * _my_ss::
  191. * ntohl::
  192. * ntohs::
  193. * outb::
  194. * outp::
  195. * outportb::
  196. * outportl::
  197. * outportsb::
  198. * outportsl::
  199. * outportsw::
  200. * outportw::
  201. * outpw::
  202. * _status87::
  203.  
  204. 
  205. File: libc,  Node: ctype functions,  Next: dos functions,  Prev: cpu functions,  Up: Functional Categories
  206.  
  207. ctype functions
  208. ===============
  209.  
  210. * Menu:
  211.  
  212. * isalnum::
  213. * isalpha::
  214. * isascii::
  215. * iscntrl::
  216. * isdigit::
  217. * isgraph::
  218. * islower::
  219. * isprint::
  220. * ispunct::
  221. * isspace::
  222. * isupper::
  223. * isxdigit::
  224. * toascii::
  225. * tolower::
  226. * toupper::
  227.  
  228. 
  229. File: libc,  Node: dos functions,  Next: dpmi functions,  Prev: ctype functions,  Up: Functional Categories
  230.  
  231. dos functions
  232. =============
  233.  
  234. * Menu:
  235.  
  236. * bdos::
  237. * bdosptr::
  238. * delay::
  239. * _dos_close::
  240. * _dos_commit::
  241. * _dos_creat::
  242. * _dos_creatnew::
  243. * _dos_findfirst::
  244. * _dos_findnext::
  245. * _dos_getdate::
  246. * _dos_getdiskfree::
  247. * _dos_getdrive::
  248. * _dos_getfileattr::
  249. * _dos_getftime::
  250. * _dos_gettime::
  251. * _dos_lock::
  252. * _dos_open::
  253. * _dos_read::
  254. * _dos_setdate::
  255. * _dos_setdrive::
  256. * _dos_setfileattr::
  257. * _dos_setftime::
  258. * _dos_settime::
  259. * _dos_unlock::
  260. * _dos_write::
  261. * dosexterr::
  262. * getcbrk::
  263. * getdisk::
  264. * int386::
  265. * int386x::
  266. * int86::
  267. * int86x::
  268. * intdos::
  269. * intdosx::
  270. * setcbrk::
  271. * setdisk::
  272.  
  273. 
  274. File: libc,  Node: dpmi functions,  Next: environment functions,  Prev: dos functions,  Up: Functional Categories
  275.  
  276. dpmi functions
  277. ==============
  278.  
  279. * Menu:
  280.  
  281. * DPMI Overview::
  282. * DPMI Specification::
  283. * __dpmi_allocate_dos_memory::
  284. * __dpmi_allocate_ldt_descriptors::
  285. * __dpmi_allocate_linear_memory::
  286. * __dpmi_allocate_memory::
  287. * __dpmi_allocate_real_mode_callback::
  288. * __dpmi_allocate_shared_memory::
  289. * __dpmi_allocate_specific_ldt_descriptor::
  290. * __dpmi_clear_debug_watchpoint::
  291. * __dpmi_create_alias_descriptor::
  292. * __dpmi_discard_page_contents::
  293. * __dpmi_free_dos_memory::
  294. * __dpmi_free_ldt_descriptor::
  295. * __dpmi_free_memory::
  296. * __dpmi_free_physical_address_mapping::
  297. * __dpmi_free_real_mode_callback::
  298. * __dpmi_free_serialization_on_shared_memory::
  299. * __dpmi_free_shared_memory::
  300. * __dpmi_get_and_disable_virtual_interrupt_state::
  301. * __dpmi_get_and_enable_virtual_interrupt_state::
  302. * __dpmi_get_and_set_virtual_interrupt_state::
  303. * __dpmi_get_capabilities::
  304. * __dpmi_get_coprocessor_status::
  305. * __dpmi_get_descriptor::
  306. * __dpmi_get_descriptor_access_rights::
  307. * __dpmi_get_extended_exception_handler_vector_pm::
  308. * __dpmi_get_extended_exception_handler_vector_rm::
  309. * __dpmi_get_free_memory_information::
  310. * __dpmi_get_memory_block_size_and_base::
  311. * __dpmi_get_memory_information::
  312. * __dpmi_get_multiple_descriptors::
  313. * __dpmi_get_page_attributes::
  314. * __dpmi_get_page_size::
  315. * __dpmi_get_processor_exception_handler_vector::
  316. * __dpmi_get_protected_mode_interrupt_vector::
  317. * __dpmi_get_raw_mode_switch_addr::
  318. * __dpmi_get_real_mode_interrupt_vector::
  319. * __dpmi_get_segment_base_address::
  320. * __dpmi_get_segment_limit::
  321. * __dpmi_get_selector_increment_value::
  322. * __dpmi_get_state_of_debug_watchpoint::
  323. * __dpmi_get_state_save_restore_addr::
  324. * __dpmi_get_vendor_specific_api_entry_point::
  325. * __dpmi_get_version::
  326. * __dpmi_get_virtual_interrupt_state::
  327. * __dpmi_install_resident_service_provider_callback::
  328. * __dpmi_int::
  329. * __dpmi_lock_linear_region::
  330. * __dpmi_map_conventional_memory_in_memory_block::
  331. * __dpmi_map_device_in_memory_block::
  332. * __dpmi_mark_page_as_demand_paging_candidate::
  333. * __dpmi_mark_real_mode_region_as_pageable::
  334. * __dpmi_physical_address_mapping::
  335. * __dpmi_relock_real_mode_region::
  336. * __dpmi_reset_debug_watchpoint::
  337. * __dpmi_resize_dos_memory::
  338. * __dpmi_resize_linear_memory::
  339. * __dpmi_resize_memory::
  340. * __dpmi_segment_to_descriptor::
  341. * __dpmi_serialize_on_shared_memory::
  342. * __dpmi_set_coprocessor_emulation::
  343. * __dpmi_set_debug_watchpoint::
  344. * __dpmi_set_descriptor::
  345. * __dpmi_set_descriptor_access_rights::
  346. * __dpmi_set_extended_exception_handler_vector_pm::
  347. * __dpmi_set_extended_exception_handler_vector_rm::
  348. * __dpmi_set_multiple_descriptors::
  349. * __dpmi_set_page_attributes::
  350. * __dpmi_set_processor_exception_handler_vector::
  351. * __dpmi_set_protected_mode_interrupt_vector::
  352. * __dpmi_set_real_mode_interrupt_vector::
  353. * __dpmi_set_segment_base_address::
  354. * __dpmi_set_segment_limit::
  355. * __dpmi_simulate_real_mode_interrupt::
  356. * __dpmi_simulate_real_mode_procedure_iret::
  357. * __dpmi_simulate_real_mode_procedure_retf::
  358. * __dpmi_simulate_real_mode_procedure_retf_stack::
  359. * __dpmi_terminate_and_stay_resident::
  360. * __dpmi_unlock_linear_region::
  361. * __dpmi_yield::
  362. * _go32_dpmi_allocate_dos_memory::
  363. * _go32_dpmi_allocate_iret_wrapper::
  364. * _go32_dpmi_allocate_real_mode_callback_iret::
  365. * _go32_dpmi_allocate_real_mode_callback_retf::
  366. * _go32_dpmi_chain_protected_mode_interrupt_vector::
  367. * _go32_dpmi_free_dos_memory::
  368. * _go32_dpmi_free_iret_wrapper::
  369. * _go32_dpmi_free_real_mode_callback::
  370. * _go32_dpmi_get_free_memory_information::
  371. * _go32_dpmi_get_protected_mode_interrupt_vector::
  372. * _go32_dpmi_get_real_mode_interrupt_vector::
  373. * _go32_dpmi_remaining_physical_memory::
  374. * _go32_dpmi_remaining_virtual_memory::
  375. * _go32_dpmi_resize_dos_memory::
  376. * _go32_dpmi_set_protected_mode_interrupt_vector::
  377. * _go32_dpmi_set_real_mode_interrupt_vector::
  378. * _go32_dpmi_simulate_fcall::
  379. * _go32_dpmi_simulate_fcall_iret::
  380. * _go32_dpmi_simulate_int::
  381. * _go32_info_block::
  382.  
  383. 
  384. File: libc,  Node: environment functions,  Next: file system functions,  Prev: dpmi functions,  Up: Functional Categories
  385.  
  386. environment functions
  387. =====================
  388.  
  389. * Menu:
  390.  
  391. * getenv::
  392. * putenv::
  393.  
  394. 
  395. File: libc,  Node: file system functions,  Next: go32 functions,  Prev: environment functions,  Up: Functional Categories
  396.  
  397. file system functions
  398. =====================
  399.  
  400. * Menu:
  401.  
  402. * access::
  403. * chdir::
  404. * chmod::
  405. * _chmod::
  406. * _close::
  407. * closedir::
  408. * _creat::
  409. * File System Extensions::
  410. * file_tree_walk::
  411. * findfirst::
  412. * findnext::
  413. * _fixpath::
  414. * fnmatch::
  415. * fnmerge::
  416. * fnsplit::
  417. * fpathconf::
  418. * __FSEXT_add_open_handler::
  419. * __FSEXT_alloc_fd::
  420. * __FSEXT_call_open_handlers::
  421. * __FSEXT_get_function::
  422. * __FSEXT_set_function::
  423. * ftw::
  424. * getcwd::
  425. * getdfree::
  426. * getftime::
  427. * getwd::
  428. * mkdir::
  429. * mkstemp::
  430. * mktemp::
  431. * _open::
  432. * opendir::
  433. * _read::
  434. * readdir::
  435. * remove::
  436. * rename::
  437. * rewinddir::
  438. * rmdir::
  439. * searchpath::
  440. * seekdir::
  441. * setftime::
  442. * statfs::
  443. * telldir::
  444. * umask::
  445. * unlink::
  446. * _use_lfn::
  447. * utime::
  448. * _write::
  449.  
  450. 
  451. File: libc,  Node: go32 functions,  Next: io functions,  Prev: file system functions,  Up: Functional Categories
  452.  
  453. go32 functions
  454. ==============
  455.  
  456. * Menu:
  457.  
  458. * _go32_conventional_mem_selector::
  459. * _go32_dpmi_lock_code::
  460. * _go32_dpmi_lock_data::
  461. * _go32_interrupt_stack_size::
  462. * _go32_my_cs::
  463. * _go32_my_ds::
  464. * _go32_my_ss::
  465. * _go32_rmcb_stack_size::
  466. * _go32_want_ctrl_break::
  467. * _go32_was_ctrl_break_hit::
  468.  
  469. 
  470. File: libc,  Node: io functions,  Next: locale functions,  Prev: go32 functions,  Up: Functional Categories
  471.  
  472. io functions
  473. ============
  474.  
  475. * Menu:
  476.  
  477. * chsize::
  478. * close::
  479. * creat::
  480. * crlf2nl::
  481. * dup::
  482. * dup2::
  483. * fcntl::
  484. * __file_exists::
  485. * filelength::
  486. * _get_dev_info::
  487. * _is_executable::
  488. * link::
  489. * lock::
  490. * lseek::
  491. * open::
  492. * read::
  493. * setmode::
  494. * stat::
  495. * tell::
  496. * truncate::
  497. * unlock::
  498. * write::
  499.  
  500. 
  501. File: libc,  Node: locale functions,  Next: math functions,  Prev: io functions,  Up: Functional Categories
  502.  
  503. locale functions
  504. ================
  505.  
  506. * Menu:
  507.  
  508. * localeconv::
  509. * mblen::
  510. * mbstowcs::
  511. * mbtowc::
  512. * setlocale::
  513. * strcoll::
  514. * strxfrm::
  515. * wcstombs::
  516. * wctomb::
  517.  
  518. 
  519. File: libc,  Node: math functions,  Next: memory functions,  Prev: locale functions,  Up: Functional Categories
  520.  
  521. math functions
  522. ==============
  523.  
  524. * Menu:
  525.  
  526. * abs::
  527. * acos::
  528. * acosh::
  529. * asin::
  530. * asinh::
  531. * atan::
  532. * atan2::
  533. * atanh::
  534. * ceil::
  535. * cos::
  536. * cosh::
  537. * div::
  538. * exp::
  539. * fabs::
  540. * floor::
  541. * fmod::
  542. * frexp::
  543. * hypot::
  544. * ldexp::
  545. * ldiv::
  546. * log::
  547. * log10::
  548. * log2::
  549. * modf::
  550. * modfl::
  551. * pow::
  552. * pow10::
  553. * pow2::
  554. * sin::
  555. * sinh::
  556. * sqrt::
  557. * tan::
  558. * tanh::
  559.  
  560. 
  561. File: libc,  Node: memory functions,  Next: misc functions,  Prev: math functions,  Up: Functional Categories
  562.  
  563. memory functions
  564. ================
  565.  
  566. * Menu:
  567.  
  568. * alloca::
  569. * bcmp::
  570. * bcopy::
  571. * brk::
  572. * bzero::
  573. * calloc::
  574. * cfree::
  575. * __djgpp_map_physical_memory::
  576. * __djgpp_memory_handle::
  577. * __djgpp_memory_handle_list::
  578. * __djgpp_nearptr_disable::
  579. * __djgpp_nearptr_enable::
  580. * __djgpp_set_page_attributes::
  581. * dosmemget::
  582. * dosmemgetb::
  583. * dosmemgetl::
  584. * dosmemgetw::
  585. * dosmemput::
  586. * dosmemputb::
  587. * dosmemputl::
  588. * dosmemputw::
  589. * _far*::
  590. * free::
  591. * malloc::
  592. * memccpy::
  593. * memchr::
  594. * memcmp::
  595. * memcpy::
  596. * memmove::
  597. * memset::
  598. * movedata::
  599. * movedatab::
  600. * movedatal::
  601. * movedataw::
  602. * mprotect::
  603. * realloc::
  604. * sbrk::
  605. * swab::
  606. * xfree::
  607. * xmalloc::
  608. * xrealloc::
  609.  
  610. 
  611. File: libc,  Node: misc functions,  Next: mono functions,  Prev: memory functions,  Up: Functional Categories
  612.  
  613. misc functions
  614. ==============
  615.  
  616. * Menu:
  617.  
  618. * assert::
  619. * bsearch::
  620. * _dxe_load::
  621. * _get_dos_version::
  622. * gethostname::
  623. * getlongpass::
  624. * getpagesize::
  625. * getpass::
  626. * insque::
  627. * labs::
  628. * longjmp::
  629. * qsort::
  630. * remque::
  631. * setjmp::
  632. * siglongjmp::
  633. * sigsetjmp::
  634.  
  635. 
  636. File: libc,  Node: mono functions,  Next: posix functions,  Prev: misc functions,  Up: Functional Categories
  637.  
  638. mono functions
  639. ==============
  640.  
  641. * Menu:
  642.  
  643. * _mono_clear::
  644. * _mono_printf::
  645. * _mono_putc::
  646.  
  647. 
  648. File: libc,  Node: posix functions,  Next: process functions,  Prev: mono functions,  Up: Functional Categories
  649.  
  650. posix functions
  651. ===============
  652.  
  653. * Menu:
  654.  
  655. * getdtablesize::
  656. * pathconf::
  657. * sysconf::
  658.  
  659. 
  660. File: libc,  Node: process functions,  Next: random number functions,  Prev: posix functions,  Up: Functional Categories
  661.  
  662. process functions
  663. =================
  664.  
  665. * Menu:
  666.  
  667. * abort::
  668. * alarm::
  669. * atexit::
  670. * exec*::
  671. * _exit::
  672. * exit::
  673. * getitimer::
  674. * kill::
  675. * nice::
  676. * pause::
  677. * setitimer::
  678. * sleep::
  679. * spawn*::
  680. * system::
  681. * usleep::
  682. * wait::
  683. * waitpid::
  684.  
  685. 
  686. File: libc,  Node: random number functions,  Next: shell functions,  Prev: process functions,  Up: Functional Categories
  687.  
  688. random number functions
  689. =======================
  690.  
  691. * Menu:
  692.  
  693. * rand::
  694. * random::
  695. * srandom::
  696.  
  697. 
  698. File: libc,  Node: shell functions,  Next: signal functions,  Prev: random number functions,  Up: Functional Categories
  699.  
  700. shell functions
  701. ===============
  702.  
  703. * Menu:
  704.  
  705. * glob::
  706. * globfree::
  707.  
  708. 
  709. File: libc,  Node: signal functions,  Next: sound functions,  Prev: shell functions,  Up: Functional Categories
  710.  
  711. signal functions
  712. ================
  713.  
  714. * Menu:
  715.  
  716. * raise::
  717. * signal::
  718.  
  719. 
  720. File: libc,  Node: sound functions,  Next: startup functions,  Prev: signal functions,  Up: Functional Categories
  721.  
  722. sound functions
  723. ===============
  724.  
  725. * Menu:
  726.  
  727. * nosound::
  728. * sound::
  729.  
  730. 
  731. File: libc,  Node: startup functions,  Next: stdio functions,  Prev: sound functions,  Up: Functional Categories
  732.  
  733. startup functions
  734. =================
  735.  
  736. * Menu:
  737.  
  738. * __crt0_glob_function::
  739. * __crt0_load_environment_file::
  740. * __crt0_setup_arguments::
  741. * _crt0_startup_flags::
  742. * _stklen::
  743.  
  744. 
  745. File: libc,  Node: stdio functions,  Next: stdlib functions,  Prev: startup functions,  Up: Functional Categories
  746.  
  747. stdio functions
  748. ===============
  749.  
  750. * Menu:
  751.  
  752. * clearerr::
  753. * _djstat_describe_lossage::
  754. * _djstat_fail_bits::
  755. * _djstat_flags::
  756. * _doprnt::
  757. * _doscan::
  758. * errno::
  759. * fclose::
  760. * fdopen::
  761. * feof::
  762. * ferror::
  763. * fflush::
  764. * fgetc::
  765. * fgetpos::
  766. * fgets::
  767. * fileno::
  768. * _fmode::
  769. * fopen::
  770. * fprintf::
  771. * fpurge::
  772. * fputc::
  773. * fputs::
  774. * fread::
  775. * freopen::
  776. * fscanf::
  777. * fseek::
  778. * fsetpos::
  779. * fstat::
  780. * fsync::
  781. * ftell::
  782. * ftruncate::
  783. * _fwalk::
  784. * fwrite::
  785. * getc::
  786. * getchar::
  787. * gets::
  788. * getw::
  789. * perror::
  790. * printf::
  791. * putc::
  792. * putchar::
  793. * puts::
  794. * putw::
  795. * rewind::
  796. * scanf::
  797. * setbuf::
  798. * setbuffer::
  799. * setlinebuf::
  800. * setvbuf::
  801. * sprintf::
  802. * sscanf::
  803. * strerror::
  804. * sys_errlist::
  805. * sys_nerr::
  806. * tmpfile::
  807. * tmpnam::
  808. * _truename::
  809. * ungetc::
  810. * vfprintf::
  811. * vprintf::
  812. * vsprintf::
  813.  
  814. 
  815. File: libc,  Node: stdlib functions,  Next: string functions,  Prev: stdio functions,  Up: Functional Categories
  816.  
  817. stdlib functions
  818. ================
  819.  
  820. * Menu:
  821.  
  822. * setenv::
  823.  
  824. 
  825. File: libc,  Node: string functions,  Next: time functions,  Prev: stdlib functions,  Up: Functional Categories
  826.  
  827. string functions
  828. ================
  829.  
  830. * Menu:
  831.  
  832. * atof::
  833. * atoi::
  834. * atol::
  835. * _atold::
  836. * ffs::
  837. * index::
  838. * itoa::
  839. * rindex::
  840. * stpcpy::
  841. * strcase::
  842. * strcasecmp::
  843. * strcat::
  844. * strchr::
  845. * strcmp::
  846. * strcpy::
  847. * strcspn::
  848. * strdup::
  849. * stricmp::
  850. * strlen::
  851. * strlwr::
  852. * strncase::
  853. * strncasecmp::
  854. * strncat::
  855. * strncmp::
  856. * strncpy::
  857. * strnicmp::
  858. * strpbrk::
  859. * strrchr::
  860. * strsep::
  861. * strspn::
  862. * strstr::
  863. * strtod::
  864. * strtok::
  865. * strtol::
  866. * _strtold::
  867. * strtoul::
  868. * strupr::
  869.  
  870. 
  871. File: libc,  Node: time functions,  Next: unix functions,  Prev: string functions,  Up: Functional Categories
  872.  
  873. time functions
  874. ==============
  875.  
  876. * Menu:
  877.  
  878. * asctime::
  879. * clock::
  880. * ctime::
  881. * difftime::
  882. * ftime::
  883. * getdate::
  884. * gettime::
  885. * gettimeofday::
  886. * gmtime::
  887. * localtime::
  888. * mktime::
  889. * rawclock::
  890. * setdate::
  891. * settime::
  892. * settimeofday::
  893. * strftime::
  894. * time::
  895. * times::
  896. * uclock::
  897. * utimes::
  898.  
  899. 
  900. File: libc,  Node: unix functions,  Prev: time functions,  Up: Functional Categories
  901.  
  902. unix functions
  903. ==============
  904.  
  905. * Menu:
  906.  
  907. * addmntent::
  908. * chown::
  909. * endgrent::
  910. * endmntent::
  911. * endpwent::
  912. * fgetgrent::
  913. * fork::
  914. * getegid::
  915. * geteuid::
  916. * getgid::
  917. * getgrent::
  918. * getgrgid::
  919. * getgrnam::
  920. * getlogin::
  921. * getmntent::
  922. * getpgrp::
  923. * getpid::
  924. * getpwent::
  925. * getpwnam::
  926. * getpwuid::
  927. * getrusage::
  928. * getuid::
  929. * hasmntopt::
  930. * isatty::
  931. * mkfifo::
  932. * mknod::
  933. * pclose::
  934. * pipe::
  935. * popen::
  936. * select::
  937. * setgrent::
  938. * setmntent::
  939. * setpgid::
  940. * setpwent::
  941. * sync::
  942. * ttyname::
  943. * uname::
  944.  
  945. 
  946. File: libc,  Node: Alphabetical List,  Prev: Functional Categories,  Up: Top
  947.  
  948. Alphabetical List
  949. *****************
  950.  
  951. * Menu:
  952.  
  953. * abort::
  954. * abs::
  955. * access::
  956. * acos::
  957. * acosh::
  958. * addmntent::
  959. * alarm::
  960. * alloca::
  961. * asctime::
  962. * asin::
  963. * asinh::
  964. * assert::
  965. * atan::
  966. * atan2::
  967. * atanh::
  968. * atexit::
  969. * atof::
  970. * atoi::
  971. * atol::
  972. * _atold::
  973. * bcmp::
  974. * bcopy::
  975. * bdos::
  976. * bdosptr::
  977. * _bios_disk::
  978. * _bios_equiplist::
  979. * _bios_keybrd::
  980. * _bios_memsize::
  981. * _bios_printer::
  982. * _bios_serialcom::
  983. * _bios_timeofday::
  984. * bioscom::
  985. * biosdisk::
  986. * biosequip::
  987. * bioskey::
  988. * biosmemory::
  989. * biosprint::
  990. * biostime::
  991. * brk::
  992. * bsearch::
  993. * bzero::
  994. * calloc::
  995. * ceil::
  996. * cfree::
  997. * cgets::
  998. * chdir::
  999. * chmod::
  1000. * _chmod::
  1001. * chown::
  1002. * chsize::
  1003. * _clear87::
  1004. * clearerr::
  1005. * clock::
  1006. * close::
  1007. * _close::
  1008. * closedir::
  1009. * clreol::
  1010. * clrscr::
  1011. * _conio_kbhit::
  1012. * _control87::
  1013. * cos::
  1014. * cosh::
  1015. * cprintf::
  1016. * cputs::
  1017. * creat::
  1018. * _creat::
  1019. * crlf2nl::
  1020. * __crt0_glob_function::
  1021. * __crt0_load_environment_file::
  1022. * __crt0_setup_arguments::
  1023. * _crt0_startup_flags::
  1024. * cscanf::
  1025. * ctime::
  1026. * delay::
  1027. * delline::
  1028. * difftime::
  1029. * disable::
  1030. * div::
  1031. * __djgpp_map_physical_memory::
  1032. * __djgpp_memory_handle::
  1033. * __djgpp_memory_handle_list::
  1034. * __djgpp_nearptr_disable::
  1035. * __djgpp_nearptr_enable::
  1036. * __djgpp_set_page_attributes::
  1037. * _djstat_describe_lossage::
  1038. * _djstat_fail_bits::
  1039. * _djstat_flags::
  1040. * _doprnt::
  1041. * _dos_close::
  1042. * _dos_commit::
  1043. * _dos_creat::
  1044. * _dos_creatnew::
  1045. * _dos_findfirst::
  1046. * _dos_findnext::
  1047. * _dos_getdate::
  1048. * _dos_getdiskfree::
  1049. * _dos_getdrive::
  1050. * _dos_getfileattr::
  1051. * _dos_getftime::
  1052. * _dos_gettime::
  1053. * _dos_lock::
  1054. * _dos_open::
  1055. * _dos_read::
  1056. * _dos_setdate::
  1057. * _dos_setdrive::
  1058. * _dos_setfileattr::
  1059. * _dos_setftime::
  1060. * _dos_settime::
  1061. * _dos_unlock::
  1062. * _dos_write::
  1063. * _doscan::
  1064. * dosexterr::
  1065. * dosmemget::
  1066. * dosmemgetb::
  1067. * dosmemgetl::
  1068. * dosmemgetw::
  1069. * dosmemput::
  1070. * dosmemputb::
  1071. * dosmemputl::
  1072. * dosmemputw::
  1073. * DPMI Overview::
  1074. * DPMI Specification::
  1075. * __dpmi_allocate_dos_memory::
  1076. * __dpmi_allocate_ldt_descriptors::
  1077. * __dpmi_allocate_linear_memory::
  1078. * __dpmi_allocate_memory::
  1079. * __dpmi_allocate_real_mode_callback::
  1080. * __dpmi_allocate_shared_memory::
  1081. * __dpmi_allocate_specific_ldt_descriptor::
  1082. * __dpmi_clear_debug_watchpoint::
  1083. * __dpmi_create_alias_descriptor::
  1084. * __dpmi_discard_page_contents::
  1085. * __dpmi_free_dos_memory::
  1086. * __dpmi_free_ldt_descriptor::
  1087. * __dpmi_free_memory::
  1088. * __dpmi_free_physical_address_mapping::
  1089. * __dpmi_free_real_mode_callback::
  1090. * __dpmi_free_serialization_on_shared_memory::
  1091. * __dpmi_free_shared_memory::
  1092. * __dpmi_get_and_disable_virtual_interrupt_state::
  1093. * __dpmi_get_and_enable_virtual_interrupt_state::
  1094. * __dpmi_get_and_set_virtual_interrupt_state::
  1095. * __dpmi_get_capabilities::
  1096. * __dpmi_get_coprocessor_status::
  1097. * __dpmi_get_descriptor::
  1098. * __dpmi_get_descriptor_access_rights::
  1099. * __dpmi_get_extended_exception_handler_vector_pm::
  1100. * __dpmi_get_extended_exception_handler_vector_rm::
  1101. * __dpmi_get_free_memory_information::
  1102. * __dpmi_get_memory_block_size_and_base::
  1103. * __dpmi_get_memory_information::
  1104. * __dpmi_get_multiple_descriptors::
  1105. * __dpmi_get_page_attributes::
  1106. * __dpmi_get_page_size::
  1107. * __dpmi_get_processor_exception_handler_vector::
  1108. * __dpmi_get_protected_mode_interrupt_vector::
  1109. * __dpmi_get_raw_mode_switch_addr::
  1110. * __dpmi_get_real_mode_interrupt_vector::
  1111. * __dpmi_get_segment_base_address::
  1112. * __dpmi_get_segment_limit::
  1113. * __dpmi_get_selector_increment_value::
  1114. * __dpmi_get_state_of_debug_watchpoint::
  1115. * __dpmi_get_state_save_restore_addr::
  1116. * __dpmi_get_vendor_specific_api_entry_point::
  1117. * __dpmi_get_version::
  1118. * __dpmi_get_virtual_interrupt_state::
  1119. * __dpmi_install_resident_service_provider_callback::
  1120. * __dpmi_int::
  1121. * __dpmi_lock_linear_region::
  1122. * __dpmi_map_conventional_memory_in_memory_block::
  1123. * __dpmi_map_device_in_memory_block::
  1124. * __dpmi_mark_page_as_demand_paging_candidate::
  1125. * __dpmi_mark_real_mode_region_as_pageable::
  1126. * __dpmi_physical_address_mapping::
  1127. * __dpmi_relock_real_mode_region::
  1128. * __dpmi_reset_debug_watchpoint::
  1129. * __dpmi_resize_dos_memory::
  1130. * __dpmi_resize_linear_memory::
  1131. * __dpmi_resize_memory::
  1132. * __dpmi_segment_to_descriptor::
  1133. * __dpmi_serialize_on_shared_memory::
  1134. * __dpmi_set_coprocessor_emulation::
  1135. * __dpmi_set_debug_watchpoint::
  1136. * __dpmi_set_descriptor::
  1137. * __dpmi_set_descriptor_access_rights::
  1138. * __dpmi_set_extended_exception_handler_vector_pm::
  1139. * __dpmi_set_extended_exception_handler_vector_rm::
  1140. * __dpmi_set_multiple_descriptors::
  1141. * __dpmi_set_page_attributes::
  1142. * __dpmi_set_processor_exception_handler_vector::
  1143. * __dpmi_set_protected_mode_interrupt_vector::
  1144. * __dpmi_set_real_mode_interrupt_vector::
  1145. * __dpmi_set_segment_base_address::
  1146. * __dpmi_set_segment_limit::
  1147. * __dpmi_simulate_real_mode_interrupt::
  1148. * __dpmi_simulate_real_mode_procedure_iret::
  1149. * __dpmi_simulate_real_mode_procedure_retf::
  1150. * __dpmi_simulate_real_mode_procedure_retf_stack::
  1151. * __dpmi_terminate_and_stay_resident::
  1152. * __dpmi_unlock_linear_region::
  1153. * __dpmi_yield::
  1154. * dup::
  1155. * dup2::
  1156. * _dxe_load::
  1157. * enable::
  1158. * endgrent::
  1159. * endmntent::
  1160. * endpwent::
  1161. * errno::
  1162. * exec*::
  1163. * _exit::
  1164. * exit::
  1165. * exp::
  1166. * fabs::
  1167. * _far*::
  1168. * fclose::
  1169. * fcntl::
  1170. * fdopen::
  1171. * feof::
  1172. * ferror::
  1173. * fflush::
  1174. * ffs::
  1175. * fgetc::
  1176. * fgetgrent::
  1177. * fgetpos::
  1178. * fgets::
  1179. * File System Extensions::
  1180. * __file_exists::
  1181. * file_tree_walk::
  1182. * filelength::
  1183. * fileno::
  1184. * findfirst::
  1185. * findnext::
  1186. * _fixpath::
  1187. * floor::
  1188. * fmod::
  1189. * _fmode::
  1190. * fnmatch::
  1191. * fnmerge::
  1192. * fnsplit::
  1193. * fopen::
  1194. * fork::
  1195. * fpathconf::
  1196. * _fpreset::
  1197. * fprintf::
  1198. * fpurge::
  1199. * fputc::
  1200. * fputs::
  1201. * fread::
  1202. * free::
  1203. * freopen::
  1204. * frexp::
  1205. * fscanf::
  1206. * fseek::
  1207. * fsetpos::
  1208. * __FSEXT_add_open_handler::
  1209. * __FSEXT_alloc_fd::
  1210. * __FSEXT_call_open_handlers::
  1211. * __FSEXT_get_function::
  1212. * __FSEXT_set_function::
  1213. * fstat::
  1214. * fsync::
  1215. * ftell::
  1216. * ftime::
  1217. * ftruncate::
  1218. * ftw::
  1219. * _fwalk::
  1220. * fwrite::
  1221. * _get_dev_info::
  1222. * _get_dos_version::
  1223. * getc::
  1224. * getcbrk::
  1225. * getch::
  1226. * getchar::
  1227. * getche::
  1228. * getcwd::
  1229. * getdate::
  1230. * getdfree::
  1231. * getdisk::
  1232. * getdtablesize::
  1233. * getegid::
  1234. * getenv::
  1235. * geteuid::
  1236. * getftime::
  1237. * getgid::
  1238. * getgrent::
  1239. * getgrgid::
  1240. * getgrnam::
  1241. * gethostname::
  1242. * getitimer::
  1243. * getkey::
  1244. * getlogin::
  1245. * getlongpass::
  1246. * getmntent::
  1247. * getpagesize::
  1248. * getpass::
  1249. * getpgrp::
  1250. * getpid::
  1251. * getpwent::
  1252. * getpwnam::
  1253. * getpwuid::
  1254. * getrusage::
  1255. * gets::
  1256. * gettext::
  1257. * gettextinfo::
  1258. * gettime::
  1259. * gettimeofday::
  1260. * getuid::
  1261. * getw::
  1262. * getwd::
  1263. * getxkey::
  1264. * glob::
  1265. * globfree::
  1266. * gmtime::
  1267. * _go32_conventional_mem_selector::
  1268. * _go32_dpmi_allocate_dos_memory::
  1269. * _go32_dpmi_allocate_iret_wrapper::
  1270. * _go32_dpmi_allocate_real_mode_callback_iret::
  1271. * _go32_dpmi_allocate_real_mode_callback_retf::
  1272. * _go32_dpmi_chain_protected_mode_interrupt_vector::
  1273. * _go32_dpmi_free_dos_memory::
  1274. * _go32_dpmi_free_iret_wrapper::
  1275. * _go32_dpmi_free_real_mode_callback::
  1276. * _go32_dpmi_get_free_memory_information::
  1277. * _go32_dpmi_get_protected_mode_interrupt_vector::
  1278. * _go32_dpmi_get_real_mode_interrupt_vector::
  1279. * _go32_dpmi_lock_code::
  1280. * _go32_dpmi_lock_data::
  1281. * _go32_dpmi_remaining_physical_memory::
  1282. * _go32_dpmi_remaining_virtual_memory::
  1283. * _go32_dpmi_resize_dos_memory::
  1284. * _go32_dpmi_set_protected_mode_interrupt_vector::
  1285. * _go32_dpmi_set_real_mode_interrupt_vector::
  1286. * _go32_dpmi_simulate_fcall::
  1287. * _go32_dpmi_simulate_fcall_iret::
  1288. * _go32_dpmi_simulate_int::
  1289. * _go32_info_block::
  1290. * _go32_interrupt_stack_size::
  1291. * _go32_my_cs::
  1292. * _go32_my_ds::
  1293. * _go32_my_ss::
  1294. * _go32_rmcb_stack_size::
  1295. * _go32_want_ctrl_break::
  1296. * _go32_was_ctrl_break_hit::
  1297. * gotoxy::
  1298. * gppconio_init::
  1299. * hasmntopt::
  1300. * highvideo::
  1301. * htonl::
  1302. * htons::
  1303. * hypot::
  1304. * inb::
  1305. * index::
  1306. * inp::
  1307. * inportb::
  1308. * inportl::
  1309. * inportsb::
  1310. * inportsl::
  1311. * inportsw::
  1312. * inportw::
  1313. * inpw::
  1314. * insline::
  1315. * insque::
  1316. * int386::
  1317. * int386x::
  1318. * int86::
  1319. * int86x::
  1320. * intdos::
  1321. * intdosx::
  1322. * _is_executable::
  1323. * isalnum::
  1324. * isalpha::
  1325. * isascii::
  1326. * isatty::
  1327. * iscntrl::
  1328. * isdigit::
  1329. * isgraph::
  1330. * islower::
  1331. * isprint::
  1332. * ispunct::
  1333. * isspace::
  1334. * isupper::
  1335. * isxdigit::
  1336. * itoa::
  1337. * kbhit::
  1338. * kill::
  1339. * labs::
  1340. * ldexp::
  1341. * ldiv::
  1342. * link::
  1343. * localeconv::
  1344. * localtime::
  1345. * lock::
  1346. * log::
  1347. * log10::
  1348. * log2::
  1349. * longjmp::
  1350. * lowvideo::
  1351. * lseek::
  1352. * malloc::
  1353. * mblen::
  1354. * mbstowcs::
  1355. * mbtowc::
  1356. * memccpy::
  1357. * memchr::
  1358. * memcmp::
  1359. * memcpy::
  1360. * memmove::
  1361. * memset::
  1362. * mkdir::
  1363. * mkfifo::
  1364. * mknod::
  1365. * mkstemp::
  1366. * mktemp::
  1367. * mktime::
  1368. * modf::
  1369. * modfl::
  1370. * _mono_clear::
  1371. * _mono_printf::
  1372. * _mono_putc::
  1373. * movedata::
  1374. * movedatab::
  1375. * movedatal::
  1376. * movedataw::
  1377. * movetext::
  1378. * mprotect::
  1379. * _my_cs::
  1380. * _my_ds::
  1381. * _my_ss::
  1382. * nice::
  1383. * normvideo::
  1384. * nosound::
  1385. * ntohl::
  1386. * ntohs::
  1387. * open::
  1388. * _open::
  1389. * opendir::
  1390. * outb::
  1391. * outp::
  1392. * outportb::
  1393. * outportl::
  1394. * outportsb::
  1395. * outportsl::
  1396. * outportsw::
  1397. * outportw::
  1398. * outpw::
  1399. * pathconf::
  1400. * pause::
  1401. * pclose::
  1402. * perror::
  1403. * pipe::
  1404. * popen::
  1405. * pow::
  1406. * pow10::
  1407. * pow2::
  1408. * printf::
  1409. * putc::
  1410. * putch::
  1411. * putchar::
  1412. * putenv::
  1413. * puts::
  1414. * puttext::
  1415. * putw::
  1416. * qsort::
  1417. * raise::
  1418. * rand::
  1419. * random::
  1420. * rawclock::
  1421. * read::
  1422. * _read::
  1423. * readdir::
  1424. * realloc::
  1425. * remove::
  1426. * remque::
  1427. * rename::
  1428. * rewind::
  1429. * rewinddir::
  1430. * rindex::
  1431. * rmdir::
  1432. * sbrk::
  1433. * scanf::
  1434. * Screen Variables::
  1435. * ScreenClear::
  1436. * ScreenCols::
  1437. * ScreenGetCursor::
  1438. * ScreenMode::
  1439. * ScreenPutChar::
  1440. * ScreenPutString::
  1441. * ScreenRetrieve::
  1442. * ScreenRows::
  1443. * ScreenSetCursor::
  1444. * ScreenUpdate::
  1445. * ScreenUpdateLine::
  1446. * ScreenVisualBell::
  1447. * searchpath::
  1448. * seekdir::
  1449. * select::
  1450. * _set_screen_lines::
  1451. * setbuf::
  1452. * setbuffer::
  1453. * setcbrk::
  1454. * _setcursortype::
  1455. * setdate::
  1456. * setdisk::
  1457. * setenv::
  1458. * setftime::
  1459. * setgrent::
  1460. * setitimer::
  1461. * setjmp::
  1462. * setlinebuf::
  1463. * setlocale::
  1464. * setmntent::
  1465. * setmode::
  1466. * setpgid::
  1467. * setpwent::
  1468. * settime::
  1469. * settimeofday::
  1470. * setvbuf::
  1471. * siglongjmp::
  1472. * signal::
  1473. * sigsetjmp::
  1474. * sin::
  1475. * sinh::
  1476. * sleep::
  1477. * sound::
  1478. * spawn*::
  1479. * sprintf::
  1480. * sqrt::
  1481. * srandom::
  1482. * sscanf::
  1483. * stat::
  1484. * statfs::
  1485. * _status87::
  1486. * _stklen::
  1487. * stpcpy::
  1488. * strcase::
  1489. * strcasecmp::
  1490. * strcat::
  1491. * strchr::
  1492. * strcmp::
  1493. * strcoll::
  1494. * strcpy::
  1495. * strcspn::
  1496. * strdup::
  1497. * strerror::
  1498. * strftime::
  1499. * stricmp::
  1500. * strlen::
  1501. * strlwr::
  1502. * strncase::
  1503. * strncasecmp::
  1504. * strncat::
  1505. * strncmp::
  1506. * strncpy::
  1507. * strnicmp::
  1508. * strpbrk::
  1509. * strrchr::
  1510. * strsep::
  1511. * strspn::
  1512. * strstr::
  1513. * strtod::
  1514. * strtok::
  1515. * strtol::
  1516. * _strtold::
  1517. * strtoul::
  1518. * strupr::
  1519. * strxfrm::
  1520. * swab::
  1521. * sync::
  1522. * sys_errlist::
  1523. * sys_nerr::
  1524. * sysconf::
  1525. * system::
  1526. * tan::
  1527. * tanh::
  1528. * tell::
  1529. * telldir::
  1530. * textattr::
  1531. * textbackground::
  1532. * textcolor::
  1533. * textmode::
  1534. * time::
  1535. * times::
  1536. * tmpfile::
  1537. * tmpnam::
  1538. * toascii::
  1539. * tolower::
  1540. * toupper::
  1541. * _truename::
  1542. * truncate::
  1543. * ttyname::
  1544. * uclock::
  1545. * umask::
  1546. * uname::
  1547. * ungetc::
  1548. * ungetch::
  1549. * unlink::
  1550. * unlock::
  1551. * _use_lfn::
  1552. * usleep::
  1553. * utime::
  1554. * utimes::
  1555. * vfprintf::
  1556. * vprintf::
  1557. * vsprintf::
  1558. * wait::
  1559. * waitpid::
  1560. * wcstombs::
  1561. * wctomb::
  1562. * wherex::
  1563. * wherey::
  1564. * window::
  1565. * write::
  1566. * _write::
  1567. * xfree::
  1568. * xmalloc::
  1569. * xrealloc::
  1570.  
  1571. 
  1572. File: libc,  Node: abort,  Next: abs,  Up: Alphabetical List
  1573.  
  1574. abort
  1575. =====
  1576.  
  1577. Syntax
  1578. ------
  1579.  
  1580.      #include <stdlib.h>
  1581.      
  1582.      void abort(void);
  1583.  
  1584. Description
  1585. -----------
  1586.  
  1587. When you call `abort', the message "Abort!" is printed on stdout and
  1588. the program exits with an exit code of one.
  1589.  
  1590. Return Value
  1591. ------------
  1592.  
  1593. This function does not return.
  1594.  
  1595. Example
  1596. -------
  1597.  
  1598.      if ((q = malloc(100)) == NULL)
  1599.        abort();
  1600.  
  1601. 
  1602. File: libc,  Node: abs,  Next: access,  Prev: abort,  Up: Alphabetical List
  1603.  
  1604. abs
  1605. ===
  1606.  
  1607. Syntax
  1608. ------
  1609.  
  1610.      #include <stdlib.h>
  1611.      
  1612.      int abs(int value);
  1613.  
  1614. Return Value
  1615. ------------
  1616.  
  1617. The absolute value of `value' is returned.
  1618.  
  1619. Example
  1620. -------
  1621.  
  1622.      int sq = 7;
  1623.      sq = sq * abs(sq) + 1;
  1624.  
  1625. 
  1626. File: libc,  Node: access,  Next: acos,  Prev: abs,  Up: Alphabetical List
  1627.  
  1628. access
  1629. ======
  1630.  
  1631. Syntax
  1632. ------
  1633.  
  1634.      #include <unistd.h>
  1635.      
  1636.      int access(const char *filename, int flags);
  1637.  
  1638. Description
  1639. -----------
  1640.  
  1641. This function determines what kind of access modes a given file allows.
  1642. The parameter FLAGS is the logical `or' of one or more of the following
  1643. flags:
  1644.  
  1645. `R_OK'
  1646.      Request if the file is readable.  Since all files are readable
  1647.      under MS-DOS, this access mode always exists.
  1648.  
  1649. `W_OK'
  1650.      Request if the file is writable.
  1651.  
  1652. `X_OK'
  1653.      Request if the file is executable.
  1654.  
  1655. `F_OK'
  1656.      Request if the file exists.
  1657.  
  1658. `D_OK'
  1659.      Request if the file is really a directory.
  1660.  
  1661. Return Value
  1662. ------------
  1663.  
  1664. Zero if the requested access mode is allowed, nonzero if not.
  1665.  
  1666. Example
  1667. -------
  1668.  
  1669.      if (access("file.ext", W_OK))
  1670.        return ERROR_CANNOT_WRITE;
  1671.      open("file.ext", O_RDWR);
  1672.  
  1673. 
  1674. File: libc,  Node: acos,  Next: acosh,  Prev: access,  Up: Alphabetical List
  1675.  
  1676. acos
  1677. ====
  1678.  
  1679. Syntax
  1680. ------
  1681.  
  1682.      #include <math.h>
  1683.      
  1684.      double acos(double x);
  1685.  
  1686. Return Value
  1687. ------------
  1688.  
  1689. The arc cosine of X.
  1690.  
  1691. 
  1692. File: libc,  Node: acosh,  Next: addmntent,  Prev: acos,  Up: Alphabetical List
  1693.  
  1694. acosh
  1695. =====
  1696.  
  1697. Syntax
  1698. ------
  1699.  
  1700.      #include <math.h>
  1701.      
  1702.      double acosh(double x);
  1703.  
  1704. Return Value
  1705. ------------
  1706.  
  1707. The arc hyperbolic cosine of X.
  1708.  
  1709. 
  1710. File: libc,  Node: addmntent,  Next: alarm,  Prev: acosh,  Up: Alphabetical List
  1711.  
  1712. addmntent
  1713. =========
  1714.  
  1715. Syntax
  1716. ------
  1717.  
  1718.      #include <mntent.h>
  1719.      
  1720.      int addmntent(FILE *filep, struct mntent *mnt);
  1721.  
  1722. Description
  1723. -----------
  1724.  
  1725. This function is a no-op for MS-DOS, but is provided to assist in Unix
  1726. ports.  *Note getmntent::.
  1727.  
  1728. Return Value
  1729. ------------
  1730.  
  1731. This function always returns nonzero to signify an error.
  1732.  
  1733. 
  1734. File: libc,  Node: alarm,  Next: alloca,  Prev: addmntent,  Up: Alphabetical List
  1735.  
  1736. alarm
  1737. =====
  1738.  
  1739. Syntax
  1740. ------
  1741.  
  1742.      #include <unistd.h>
  1743.      
  1744.      unsigned alarm(unsigned seconds);
  1745.  
  1746. Description
  1747. -----------
  1748.  
  1749. This function causes the signal SIGALRM to be raised in SECONDS seconds.
  1750. A value of zero for SECONDS cancels any pending alarm.  If an alarm has
  1751. previously been set, the new alarm delay will superceed the prior call.
  1752.  
  1753. Return Value
  1754. ------------
  1755.  
  1756. The number of seconds remaining on the timer (i.e. always SECONDS).
  1757.  
  1758. Example
  1759. -------
  1760.  
  1761.      signal(SIGALRM,my_alarm_routine);
  1762.      alarm(5);
  1763.  
  1764. 
  1765. File: libc,  Node: alloca,  Next: asctime,  Prev: alarm,  Up: Alphabetical List
  1766.  
  1767. alloca
  1768. ======
  1769.  
  1770. Syntax
  1771. ------
  1772.  
  1773.      #include <stdlib.h>
  1774.      
  1775.      void *alloca(size_t _size)
  1776.  
  1777. Description
  1778. -----------
  1779.  
  1780. Allocate memory that will be automatically released when the current
  1781. procedure exits.  Note that, when compiling with gcc, alloca is a
  1782. built-in function and not a library call.
  1783.  
  1784. Return Value
  1785. ------------
  1786.  
  1787. A pointer to the memory, else NULL.
  1788.  
  1789. Example
  1790. -------
  1791.  
  1792.      q = alloca(strlen(x)+1);
  1793.      strcpy(q, x);
  1794.  
  1795. 
  1796. File: libc,  Node: asctime,  Next: asin,  Prev: alloca,  Up: Alphabetical List
  1797.  
  1798. asctime
  1799. =======
  1800.  
  1801. Syntax
  1802. ------
  1803.  
  1804.      #include <time.h>
  1805.      
  1806.      char *asctime(const struct tm *tptr);
  1807.  
  1808. Description
  1809. -----------
  1810.  
  1811. This function returns an ASCII representation of the time represented by
  1812. TPTR.  The string returned is always 26 characters and has this format:
  1813.  
  1814.      Sun Jan 01 12:34:56 1993\n\0
  1815.  
  1816. The string pointed to is in a static buffer and will be overridden with
  1817. each call to asctime.  The data should be copied if it needs to be
  1818. preserved.
  1819.  
  1820. Return Value
  1821. ------------
  1822.  
  1823. A pointer to the string.
  1824.  
  1825. Example
  1826. -------
  1827.  
  1828.      time_t now;
  1829.      time(&now);
  1830.      printf("The current time is %s", asctime(localtime(&now)));
  1831.  
  1832. 
  1833. File: libc,  Node: asin,  Next: asinh,  Prev: asctime,  Up: Alphabetical List
  1834.  
  1835. asin
  1836. ====
  1837.  
  1838. Syntax
  1839. ------
  1840.  
  1841.      #include <math.h>
  1842.      
  1843.      double asin(double x);
  1844.  
  1845. Return Value
  1846. ------------
  1847.  
  1848. The arc sine of X.
  1849.  
  1850. 
  1851. File: libc,  Node: asinh,  Next: assert,  Prev: asin,  Up: Alphabetical List
  1852.  
  1853. asinh
  1854. =====
  1855.  
  1856. Syntax
  1857. ------
  1858.  
  1859.      #include <math.h>
  1860.      
  1861.      double asinh(double x);
  1862.  
  1863. Return Value
  1864. ------------
  1865.  
  1866. The arc hyperbolic sine of X.
  1867.  
  1868. 
  1869. File: libc,  Node: assert,  Next: atan,  Prev: asinh,  Up: Alphabetical List
  1870.  
  1871. assert
  1872. ======
  1873.  
  1874. Syntax
  1875. ------
  1876.  
  1877.      #define NDEBUG
  1878.      #include <assert.h>
  1879.      
  1880.      assert(expression);
  1881.      assertval(expression);
  1882.  
  1883. Description
  1884. -----------
  1885.  
  1886. These macros are used to assist in debugging.  The source code includes
  1887. references to assert and assertval, passing them expressions that should
  1888. be true (or non-zero).  When the expression equals zero, a diagnostic
  1889. message is printed to stderr and the program aborts.
  1890.  
  1891. If you define the macro `NDEBUG' before including `assert.h', then the
  1892. macros expand to nothing to reduce code size after debugging is done.
  1893.  
  1894. Return Value
  1895. ------------
  1896.  
  1897. `assert' returns one if it passes, else it aborts.
  1898.  
  1899. `assertval' returns the value of the expression if nonzero, else it
  1900. aborts.
  1901.  
  1902. Example
  1903. -------
  1904.  
  1905.      int strdup(char *s)
  1906.      {
  1907.        assert(s != 0);
  1908.  
  1909. 
  1910. File: libc,  Node: atan,  Next: atan2,  Prev: assert,  Up: Alphabetical List
  1911.  
  1912. atan
  1913. ====
  1914.  
  1915. Syntax
  1916. ------
  1917.  
  1918.      #include <math.h>
  1919.      
  1920.      double atan(double x);
  1921.  
  1922. Return Value
  1923. ------------
  1924.  
  1925. The arc tangent of X.
  1926.  
  1927. 
  1928. File: libc,  Node: atan2,  Next: atanh,  Prev: atan,  Up: Alphabetical List
  1929.  
  1930. atan2
  1931. =====
  1932.  
  1933. Syntax
  1934. ------
  1935.  
  1936.      #include <math.h>
  1937.      
  1938.      double atan2(double y, double x);
  1939.  
  1940. Return Value
  1941. ------------
  1942.  
  1943. The arc tangent of Y/X, with appropriate return values for Y=0 or X=0.
  1944.  
  1945. 
  1946. File: libc,  Node: atanh,  Next: atexit,  Prev: atan2,  Up: Alphabetical List
  1947.  
  1948. atanh
  1949. =====
  1950.  
  1951. Syntax
  1952. ------
  1953.  
  1954.      #include <math.h>
  1955.      
  1956.      double atanh(double x);
  1957.  
  1958. Return Value
  1959. ------------
  1960.  
  1961. The arc hyperbolic tangent of X.
  1962.  
  1963. 
  1964. File: libc,  Node: atexit,  Next: atof,  Prev: atanh,  Up: Alphabetical List
  1965.  
  1966. atexit
  1967. ======
  1968.  
  1969. Syntax
  1970. ------
  1971.  
  1972.      #include <stdlib.h>
  1973.      
  1974.      int atexit(void (*func)(void));
  1975.  
  1976. Description
  1977. -----------
  1978.  
  1979. This function places the specified function FUNC on a list of functions
  1980. to be called when `exit' is called.  These functions are called as if a
  1981. last-in-first-out queue is used, that is, the last function registered
  1982. with `atexit' will be the first function called by `exit'.
  1983.  
  1984. At least 32 functions can be registered this way.
  1985.  
  1986. Return Value
  1987. ------------
  1988.  
  1989. Zero on success, non-zero on error.
  1990.  
  1991. Example
  1992. -------
  1993.  
  1994.      void exit_func()
  1995.      {
  1996.        remove("file.tmp");
  1997.      }
  1998.      
  1999.      ...
  2000.      atexit(exit_func);
  2001.      ...
  2002.  
  2003. 
  2004. File: libc,  Node: atof,  Next: atoi,  Prev: atexit,  Up: Alphabetical List
  2005.  
  2006. atof
  2007. ====
  2008.  
  2009. Syntax
  2010. ------
  2011.  
  2012.      #include <stdlib.h>
  2013.      
  2014.      double atof(const char *string);
  2015.  
  2016. Description
  2017. -----------
  2018.  
  2019. Convert as much of the string as possible to an equivalent double
  2020. precision real number.
  2021.  
  2022. This function is almost like `strtod(string, NULL)' (*note strtod::.).
  2023.  
  2024. Return Value
  2025. ------------
  2026.  
  2027. The equivalent value, or zero if the string does not represent a number.
  2028.  
  2029. Example
  2030. -------
  2031.  
  2032.      main(int argc, char **argv)
  2033.      {
  2034.        double d = atof(argv[1]);
  2035.        ...
  2036.  
  2037. 
  2038. File: libc,  Node: atoi,  Next: atol,  Prev: atof,  Up: Alphabetical List
  2039.  
  2040. atoi
  2041. ====
  2042.  
  2043. Syntax
  2044. ------
  2045.  
  2046.      #include <stdlib.h>
  2047.      
  2048.      int atoi(const char *string);
  2049.  
  2050. Description
  2051. -----------
  2052.  
  2053. Convert as much of the string as possible to an equivalent integer
  2054. value.
  2055.  
  2056. This function is almost like `(int)strtol(string, NULL, 10)' (*note
  2057. strtol::.).
  2058.  
  2059. Return Value
  2060. ------------
  2061.  
  2062. The equivalent value, or zero if the string does not represent a number.
  2063.  
  2064. Example
  2065. -------
  2066.  
  2067.      main(int argc, char **argv)
  2068.      {
  2069.        int i = atoi(argv[1]);
  2070.        ...
  2071.  
  2072. 
  2073. File: libc,  Node: atol,  Next: _atold,  Prev: atoi,  Up: Alphabetical List
  2074.  
  2075. atol
  2076. ====
  2077.  
  2078. Syntax
  2079. ------
  2080.  
  2081.      #include <stdlib.h>
  2082.      
  2083.      long atol(const char *string);
  2084.  
  2085. Description
  2086. -----------
  2087.  
  2088. Convert as much of the string as possible to an equivalent long integer
  2089. value.
  2090.  
  2091. This function is almost like `strtol(string, NULL, 10)' (*note
  2092. strtol::.).
  2093.  
  2094. Return Value
  2095. ------------
  2096.  
  2097. The equivalent value, or zero if the string does not represent a number.
  2098.  
  2099. Example
  2100. -------
  2101.  
  2102.      main(int argc, char **argv)
  2103.      {
  2104.        long l = atol(argv[1]);
  2105.        ...
  2106.  
  2107. 
  2108. File: libc,  Node: _atold,  Next: bcmp,  Prev: atol,  Up: Alphabetical List
  2109.  
  2110. _atold
  2111. ======
  2112.  
  2113. Syntax
  2114. ------
  2115.  
  2116.      #include <stdlib.h>
  2117.      
  2118.      long double _atold(const char *string);
  2119.  
  2120. Description
  2121. -----------
  2122.  
  2123. Convert as much of the string as possible to an equivalent long double
  2124. precision real number.
  2125.  
  2126. This function is almost like `_strtold(string, NULL)' (*note
  2127. _strtold::.).
  2128.  
  2129. Return Value
  2130. ------------
  2131.  
  2132. The equivalent value, or zero if the string does not represent a number.
  2133.  
  2134. Example
  2135. -------
  2136.  
  2137.      main(int argc, char **argv)
  2138.      {
  2139.        long double d = _atold(argv[1]);
  2140.        ...
  2141.  
  2142. 
  2143. File: libc,  Node: bcmp,  Next: bcopy,  Prev: _atold,  Up: Alphabetical List
  2144.  
  2145. bcmp
  2146. ====
  2147.  
  2148. Syntax
  2149. ------
  2150.  
  2151.      #include <string.h>
  2152.      
  2153.      int bcmp(const void *ptr1, const void *ptr2, int length);
  2154.  
  2155. Description
  2156. -----------
  2157.  
  2158. Compare memory pointed to by PTR1 and PTR2 for at most LENGTH bytes.
  2159.  
  2160. Return Value
  2161. ------------
  2162.  
  2163. The number of bytes remaining when the first mismatch occurred, or zero
  2164. if all bytes were equal.
  2165.  
  2166. Example
  2167. -------
  2168.  
  2169.      void f(char *s1, char *s2)
  2170.      {
  2171.        int l = bcmp(s1, s2, strlen(s1));
  2172.        printf("Difference: %s, %s\n", s1+strlen(s1)-l, s2+strlen(s1)-l);
  2173.      }
  2174.  
  2175. 
  2176. File: libc,  Node: bcopy,  Next: bdos,  Prev: bcmp,  Up: Alphabetical List
  2177.  
  2178. bcopy
  2179. =====
  2180.  
  2181. Syntax
  2182. ------
  2183.  
  2184.      #include <string.h>
  2185.      
  2186.      void bcopy(const void *source, void *dest, int length);
  2187.  
  2188. Description
  2189. -----------
  2190.  
  2191. Copy LENGTH bytes from SOURCE to DEST.  Overlapping regions are handled
  2192. properly, although this behavior is not portable.
  2193.  
  2194. Return Value
  2195. ------------
  2196.  
  2197. No value is returned.
  2198.  
  2199. Example
  2200. -------
  2201.  
  2202.      struct s a, b;
  2203.      bcopy(a, b, sizeof(struct s));
  2204.  
  2205. 
  2206. File: libc,  Node: bdos,  Next: bdosptr,  Prev: bcopy,  Up: Alphabetical List
  2207.  
  2208. bdos
  2209. ====
  2210.  
  2211. Syntax
  2212. ------
  2213.  
  2214.      #include <dos.h>
  2215.      
  2216.      int bdos(int func, unsigned dx, unsigned al);
  2217.  
  2218. Description
  2219. -----------
  2220.  
  2221. Calls function FUNC of the software interrupt 0x21, passing it AL as
  2222. the subfunction and (the lower 16 bit of) DX in the `DX' register.
  2223. This function will only work for a subset of DOS functions which
  2224. require no arguments at all, or take non-pointer arguments in the `AL'
  2225. and `DX' registers only.  For functions which require a pointer in the
  2226. `DX' register, use `bdosptr' (*note bdosptr::.).
  2227.  
  2228. Return Value
  2229. ------------
  2230.  
  2231. Whatever the called function returns in the AX register.
  2232.  
  2233. Example
  2234. -------
  2235.  
  2236.      /* read a character */
  2237.      int ch = bdos(1, 0, 0) & 0xff;
  2238.  
  2239. 
  2240. File: libc,  Node: bdosptr,  Next: _bios_disk,  Prev: bdos,  Up: Alphabetical List
  2241.  
  2242. bdosptr
  2243. =======
  2244.  
  2245. Syntax
  2246. ------
  2247.  
  2248.      #include <dos.h>
  2249.      
  2250.      int bdosptr(int func, void *ptr, unsigned al);
  2251.  
  2252. Description
  2253. -----------
  2254.  
  2255. Calls function FUNC of the software interrupt 0x21, passing it AL as
  2256. the subfunction and a pointer to a copy of the buffer contents whose
  2257. address is in PTR through the `DX' register.  This function will only
  2258. work for a subset of DOS which require an argument in the `AL' register
  2259. and a pointer in `DX' register.  For functions which require
  2260. non-pointer arguments in the `DX' register, use `bdos' (*note bdos::.).
  2261. To make the contents of PTR available to DOS, `bdosptr' copies it to
  2262. the transfer buffer located in the low (below 1 Meg mark) memory.
  2263.  
  2264. Currently, some of the functions which take a pointer to a buffer in
  2265. `DX' are *NOT* supported (notably, most of the FCB-based functions).
  2266. *Note int86:: for the list of supported functions.
  2267.  
  2268. Return Value
  2269. ------------
  2270.  
  2271. Whatever the called function returns in the AX register.
  2272.  
  2273. Example
  2274. -------
  2275.  
  2276.      /* print a string */
  2277.      bdos(9, "Hello, there$", 0);
  2278.  
  2279. 
  2280. File: libc,  Node: _bios_disk,  Next: _bios_equiplist,  Prev: bdosptr,  Up: Alphabetical List
  2281.  
  2282. _bios_disk
  2283. ==========
  2284.  
  2285. Syntax
  2286. ------
  2287.  
  2288.      #include <bios.h>
  2289.      
  2290.      unsigned _bios_disk(unsigned cmd, struct diskinfo_t *di)
  2291.  
  2292. Description
  2293. -----------
  2294.  
  2295. This function interfaces with the BIOS disk sevice (interrupt 0x13).
  2296. The parameter CMD select the corresponding disk service and the
  2297. structure DI holds the disk parameters.
  2298.  
  2299.      struct diskinfo_t {
  2300.        unsigned drive;       /* Drive number. */
  2301.        unsigned head;        /* Head number. */
  2302.        unsigned track;       /* Track number. */
  2303.        unsigned sector;      /* Sector number. */
  2304.        unsigned nsectors;    /* Number of sectors to read/write/verify. */
  2305.        void    *buffer;      /* Buffer for reading/writing/verifying. */
  2306.      }
  2307.  
  2308. The following services are available based on value of CMD:
  2309.  
  2310. `_DISK_RESET'
  2311.      Forces the disk controller to do a hard reset, preparing for
  2312.      floppy-disk I/O. This is useful after an error occurs in another
  2313.      operation, such as a read. If this service is specified, the DI
  2314.      argument is ignored. Status is returned in the 8 high-order bits
  2315.      (AH) of the return value. If there is an error, the high-order
  2316.      byte will contain a set of status flags, as defined below under
  2317.      Return Value.
  2318.  
  2319. `_DISK_STATUS'
  2320.      Obtains the status of the last disk operation. If this service is
  2321.      specified, the <diskinfo> argument is ignored. Status is returned
  2322.      in the 8 low-order bits (AL) of the return value. If there is an
  2323.      error, the low-order byte (AL) will contain a set of status flags,
  2324.      as defined below under Return Value.
  2325.  
  2326. `_DISK_READ'
  2327.      Reads one or more disk sectors into memory. This service uses all
  2328.      fields of the structure pointed to by DISKINFO. If no error
  2329.      occurs, the function returns 0 in the high-order byte and the
  2330.      number of sectors read in the low-order byte. If there is an
  2331.      error, the high-order byte (AH) will contain a set of status
  2332.      flags, as defined below under Return Value.
  2333.  
  2334. `_DISK_WRITE'
  2335.      Writes data from memory to one or more disk sectors. This service
  2336.      uses all fields of the structure pointed to by <diskinfo>. If no
  2337.      error occurs, the function returns 0 in the high-order byte (AH)
  2338.      and the number of sectors written in the low-order byte (AL). If
  2339.      there is an error, the high-order byte will contain a set of
  2340.      status flags, as defined below under Return Value.
  2341.  
  2342. `_DISK_FORMAT'
  2343.      Formats the track specified by DISKINFO. The HEAD and TRACK fields
  2344.      indicate the track to format. Only one track can be formatted in a
  2345.      single call. The BUFFER field points to a set of sector markers.
  2346.      The format of the markers depends on the type of disk drive (see a
  2347.      technical reference to the PC BIOS to determine the marker
  2348.      format). The high-order byte (AH) of the return value contains the
  2349.      status of the call; 0 equals success. If there is an error, the
  2350.      high-order byte will contain a set of status flags, as defined
  2351.      below under Return Value.
  2352.  
  2353. `_DISK_VERIFY'
  2354.      Checks the disk to be sure the specified sectors exist and can be
  2355.      read.  It also runs a CRC (cyclic redundancy check) test. This
  2356.      service uses all fields (except BUFFER) of the structure pointed
  2357.      to by DISKINFO.  If no error occurs, the function returns 0 in the
  2358.      high-order byte (AH) and the number of sectors compared in the
  2359.      low-order byte (AL), as defined below under Return Value.
  2360.  
  2361. Return Value
  2362. ------------
  2363.  
  2364. Return value of AX register. The meaning of high-order byte (AH):
  2365.      0x00  No error
  2366.      0x01  Invalid request or a bad command
  2367.      0x02  Address mark not found
  2368.      0x03  Disk write protected
  2369.      0x04  Sector not found
  2370.      0x05  Reset failed
  2371.      0x06  Floppy disk removed
  2372.      0x07  Drive parameter activity failed
  2373.      0x08  Direct Memory Access (DMA) overrun
  2374.      0x09  DMA crossed 64K boundary
  2375.      0x0A  Bad sector flag detected
  2376.      0x0B  Bad track flag detected
  2377.      0x0C  Media type not found
  2378.      0x0D  Invalid number of sectors on format
  2379.      0x0E  Control data access mark detected
  2380.      0x0F  DMA arbitration level out of range
  2381.      0x10  Data read (CRC or ECC) error
  2382.      0x11  Corrected data read (ECC) error
  2383.      0x20  Controller failure
  2384.      0x40  Seek error
  2385.      0x80  Disk timed out or failed to respond
  2386.      0xAA  Drive not ready
  2387.      0xBB  Undefined error
  2388.      0xCC  Write fault on drive
  2389.      0xE0  Status error
  2390.      0xFF  Sense operation failed
  2391.  
  2392. Example
  2393. -------
  2394.  
  2395.      char record_buffer[512];
  2396.      struct diskinfo_t di;
  2397.      
  2398.      di.drive    = 0x80;
  2399.      di.head     = 0;
  2400.      di.track    = 0;
  2401.      di.sector   = 0;
  2402.      di.nsectors = 1;
  2403.      di.buffer   = &record_buffer;
  2404.      if ( _bios_disk(_DISK_READ, &di) )
  2405.        puts("Disk error.");
  2406.  
  2407. 
  2408. File: libc,  Node: _bios_equiplist,  Next: _bios_keybrd,  Prev: _bios_disk,  Up: Alphabetical List
  2409.  
  2410. _bios_equiplist
  2411. ===============
  2412.  
  2413. Syntax
  2414. ------
  2415.  
  2416.      #include <bios.h>
  2417.      
  2418.      unsigned _bios_equiplist(void)
  2419.  
  2420. Description
  2421. -----------
  2422.  
  2423. This function returns the equipment word from BIOS request 0x11.  The
  2424. bits correspond to the following values:
  2425.  
  2426.      Bits  Meaning
  2427.      0     True (1) if disk drive(s) installed
  2428.      1     True (1) if math coprocessor installed
  2429.      2-3   System RAM in 16K blocks (16-64K)
  2430.      4-5   Initial video mode:
  2431.                 00 = Reserved
  2432.                 01 = 40 x 25 color
  2433.                 10 = 80 x 25 color
  2434.                 11 = 80 x 25 monochrome
  2435.      6-7   Number of floppy-disk drives installed
  2436.            (00 = 1, 01 = 2, etc.)
  2437.      8     False (0) if and only if a Direct Memory Access (DMA)
  2438.            chip is installed
  2439.      9-11  Number of RS232 serial ports installed
  2440.      12    True (1) if and only if a game adapter is installed
  2441.      13    True (1) if and only if an internal modem is installed
  2442.      14-15 Number of printers installed
  2443.  
  2444. Return Value
  2445. ------------
  2446.  
  2447. The equipment word.
  2448.  
  2449. Example
  2450. -------
  2451.  
  2452.      if ( _bios_equip() & 0xc000 )
  2453.        do_printing();
  2454.  
  2455. 
  2456. File: libc,  Node: _bios_keybrd,  Next: _bios_memsize,  Prev: _bios_equiplist,  Up: Alphabetical List
  2457.  
  2458. _bios_keybrd
  2459. ============
  2460.  
  2461. Syntax
  2462. ------
  2463.  
  2464.      #include <bios.h>
  2465.      
  2466.      unsigned _bios_keybrd(unsigned cmd);
  2467.  
  2468. Description
  2469. -----------
  2470.  
  2471. The _bios_keybrd routine uses INT 0x16 to access the keyboard services.
  2472. The CMD argument can be any of the following manifest constants:
  2473.  
  2474. `_KEYBRD_READ'
  2475.      Read the next key pressed
  2476.  
  2477. `_NKEYBRD_READ'
  2478.      Read the next extended key pressed
  2479.  
  2480. `_KEYBRD_READY'
  2481.      Check if the next key in the keyboard buffer
  2482.  
  2483. `_NKEYBRD_READY'
  2484.      Check if the next extended key in the keyboard buffer
  2485.  
  2486. `_KEYBRD_SHIFTSTATUS'
  2487.      Read keyboard shift state (0x0040:0x0017 byte):
  2488.  
  2489.           7654 3210  Meaning
  2490.           ---- ---X  Right SHIFT is pressed
  2491.           ---- --X-  Left SHIFT is pressed
  2492.           ---- -X--  CTRL is pressed
  2493.           ---- X---  ALT is pressed
  2494.           ---X ----  Scroll Lock locked
  2495.           --X- ----  Num Lock locked
  2496.           -X-- ----  Caps Lock locked
  2497.           X--- ----  Insert locked
  2498.  
  2499. `_NKEYBRD_SHIFTSTATUS'
  2500.      Read keyboard shift and extended shift state (0x0040:0x0017 word):
  2501.  
  2502.           FEDC BA98  7654 3210  Meaning
  2503.           ---- ----  ---- ---X  Right SHIFT is pressed
  2504.           ---- ----  ---- --X-  Left SHIFT is pressed
  2505.           ---- ----  ---- -X--  CTRL is pressed
  2506.           ---- ----  ---- X---  ALT is pressed
  2507.           ---- ----  ---X ----  Scroll Lock locked
  2508.           ---- ----  --X- ----  Num Lock locked
  2509.           ---- ----  -X-- ----  Caps Lock locked
  2510.           ---- ----  X--- ----  Insert locked
  2511.           
  2512.           ---- ---X  ---- ----  Left CTRL is pressed
  2513.           ---- --X-  ---- ----  Left ALT is pressed
  2514.           ---- -X--  ---- ----  Right CTRL is pressed
  2515.           ---- X---  ---- ----  Right ALT is pressed
  2516.           ---X ----  ---- ----  Scroll Lock is pressed
  2517.           --X- ----  ---- ----  Num Lock is pressed
  2518.           -X-- ----  ---- ----  Caps Lock is pressed
  2519.           X--- ----  ---- ----  SysReq is pressed
  2520.  
  2521. Return Value
  2522.  
  2523. With the ???_READ and ???_SHIFTSTATUS arguments, the _bios_keybrd
  2524. function returns the contents of the AX register after the BIOS call.
  2525.  
  2526. With the ???_READY argument, _bios_keybrd returns 0 if there is no key.
  2527. If there is a key, _bios_keybrd returns the key waiting to be read
  2528. (that is, the same value as _KEYBRD_READ).
  2529.  
  2530. With the ???_READ and ???_READY arguments, the _bios_keybrd function
  2531. returns -1 if CTRL+BREAK has been pressed and is the next keystroke to
  2532. be read.
  2533.  
  2534. Example
  2535. -------
  2536.  
  2537.      while( !_bios_keybrd(_KEYBRD_READY) )
  2538.        try_to_do_something();
  2539.  
  2540. 
  2541. File: libc,  Node: _bios_memsize,  Next: _bios_printer,  Prev: _bios_keybrd,  Up: Alphabetical List
  2542.  
  2543. _bios_memsize
  2544. =============
  2545.  
  2546. Syntax
  2547. ------
  2548.  
  2549.      #include <bios.h>
  2550.      
  2551.      unsigned _bios_memsize(void);
  2552.  
  2553. Description
  2554. -----------
  2555.  
  2556. This function returns the amount of system memory in 1K blocks (up to
  2557. 640K).
  2558.  
  2559. Return Value
  2560. ------------
  2561.  
  2562. Size of memory (in K).
  2563.  
  2564. Example
  2565. -------
  2566.  
  2567.      printf("This system has %d bytes of memory\n", _bios_memsize() * 1024);
  2568.  
  2569. 
  2570. File: libc,  Node: _bios_printer,  Next: _bios_serialcom,  Prev: _bios_memsize,  Up: Alphabetical List
  2571.  
  2572. _bios_printer
  2573. =============
  2574.  
  2575. Syntax
  2576. ------
  2577.  
  2578.      #include <bios.h>
  2579.      
  2580.      unsigned _bios_printer(unsigned cmd, unsigned printer, unsigned data);
  2581.  
  2582. Description
  2583. -----------
  2584.  
  2585. The _bios_printer routine uses INT 0x17 to perform printer output
  2586. services for parallel printers. The PRINTER argument specifies the
  2587. affected printer, where 0 is LPT1, 1 is LPT2, and so on.  The CMD
  2588. argument can be any of the following manifest constants:
  2589.  
  2590. `_PRINTER_INIT'
  2591. `Reset and initialize the specified printer port'
  2592. `_PRINTER_STATUS'
  2593.      Return the status of the specified printer port
  2594.  
  2595. `_PRINTER_WRITE'
  2596.      Print the DATA argument to the specified printer port
  2597.  
  2598. Return Value
  2599. ------------
  2600.  
  2601. The _bios_printer function returns the value in the AX register after
  2602. the BIOS interrupt. The high-order byte (AH) of the return value
  2603. indicates the printer status after the operation, as defined below:
  2604.  
  2605.      Bit     Meaning if True
  2606.      
  2607.      0       Printer timed out
  2608.      1       Not used
  2609.      2       Not used
  2610.      3       I/O error
  2611.      4       Printer selected
  2612.      5       Out of paper
  2613.      6       Acknowledge
  2614.      7       Printer not busy
  2615.  
  2616. Example
  2617. -------
  2618.  
  2619.      while (*c)
  2620.        _bios_printer(_PRINTER_WRITE, *c++, 0);
  2621.  
  2622. 
  2623. File: libc,  Node: _bios_serialcom,  Next: _bios_timeofday,  Prev: _bios_printer,  Up: Alphabetical List
  2624.  
  2625. _bios_serialcom
  2626. ===============
  2627.  
  2628. Syntax
  2629. ------
  2630.  
  2631.      #include <bios.h>
  2632.      
  2633.      unsigned _bios_serialcom(unsigned cmd, unsingned serialport, unsigned data);
  2634.  
  2635. Description
  2636. -----------
  2637.  
  2638. The _bios_serialcom routine uses INT 0x14 to provide serial
  2639. communications services. The SERIALPORT argument is set to 0 for COM1,
  2640. to 1 for COM2, and so on. The CMD argument can be set to one of the
  2641. following manifest constants:
  2642.  
  2643. `_COM_INIT'
  2644.      Initialize com port (DATA is the settings)
  2645.  
  2646. `_COM_RECEIVE'
  2647.      Read a byte from port
  2648.  
  2649. `_COM_SEND'
  2650.      Write a byte to port
  2651.  
  2652. `_COM_STATUS'
  2653.      Get the port status
  2654.  
  2655. The DATA argument is ignored if CMD is set to _COM_RECEIVE or
  2656. _COM_STATUS. The DATA argument for _COM_INIT is created by combining
  2657. one or more of the following constants (with the OR operator):
  2658.  
  2659.      _COM_CHR7         7 bits/character
  2660.      _COM_CHR8         8 bits/character
  2661.      _COM_STOP1        1 stop bit
  2662.      _COM_STOP2        2 stop bits
  2663.      _COM_NOPARITY     no parity
  2664.      _COM_EVENPARITY   even parity
  2665.      _COM_ODDPARITY    odd parity
  2666.      _COM_110          110 baud
  2667.      _COM_150          150 baud
  2668.      _COM_300          300 baud
  2669.      _COM_600          600 baud
  2670.      _COM_1200         1200 baud
  2671.      _COM_2400         2400 baud
  2672.      _COM_4800         4800 baud
  2673.      _COM_9600         9600 baud
  2674.  
  2675. The default value of DATA is 1 stop bit, no parity, and 110 baud.
  2676.  
  2677. Return Value
  2678. ------------
  2679.  
  2680. The function returns a 16-bit integer whose high-order byte contains
  2681. status bits. The meaning of the low-order byte varies, depending on the
  2682. CMD value. The high-order bits are as follows:
  2683.  
  2684.      Bit     Meaning if Set
  2685.      
  2686.      15      Timed out
  2687.      14      Transmission-shift register empty
  2688.      13      Transmission-hold register empty
  2689.      12      Break detected
  2690.      11      Framing error
  2691.      10      Parity error
  2692.       9      Overrun error
  2693.       8      Data ready
  2694.  
  2695. When service is _COM_SEND, bit 15 is set if data cannot be sent.
  2696.  
  2697. When service is _COM_RECEIVE, the byte read is returned in the
  2698. low-order bits if the call is successful. If an error occurs, any of
  2699. the bits 9, 10, 11, or 15 is set.
  2700.  
  2701. When service is _COM_INIT or _COM_STATUS, the low-order bits are
  2702. defined as follows:
  2703.  
  2704.      Bit     Meaning if Set
  2705.      
  2706.      7       Receive-line signal detected
  2707.      6       Ring indicator
  2708.      5       Data-set-ready
  2709.      4       Clear-to-send
  2710.      3       Change in receive-line signal detected
  2711.      2       Trailing-edge ring indicator
  2712.      1       Change in data-set-ready status
  2713.      0       Change in clear-to-send status
  2714.  
  2715. Example
  2716. -------
  2717.  
  2718.      /* 9600 baud, no parity, one stop, 8 bits */
  2719.      _bios_serialcom(_COM_INIT, 0, _COM_9600|_COM_NOPARITY|_COM_STOP1|_COM_CHR8);
  2720.      for(i=0; buf[i]; i++)
  2721.        _bios_serialcom(_COM_SEND, 0, buf[i]);
  2722.  
  2723. 
  2724. File: libc,  Node: _bios_timeofday,  Next: bioscom,  Prev: _bios_serialcom,  Up: Alphabetical List
  2725.  
  2726. _bios_timeofday
  2727. ===============
  2728.  
  2729. Syntax
  2730. ------
  2731.  
  2732.      #include <bios.h>
  2733.      
  2734.      unsigned _bios_timeofday(unsigned cmd, unsigned long *timeval);
  2735.  
  2736. Description
  2737. -----------
  2738.  
  2739. The _bios_timeofday routine uses INT 0x1A to get or set the clock count
  2740. (which is the number of 18.2 Hz ticks since midnight). The CMD argument
  2741. can be either the _TIME_GETCLOCK or _TIME_SETCLOCK manifest constant.
  2742.  
  2743. Return Value
  2744. ------------
  2745.  
  2746. If the argument is _TIME_GETCLOCK, the routine returns a nonzero value
  2747. if midnight was passed since last read, or zero if midnight was not
  2748. passed. If the argument is _TIME_SETCLOCK, the return value is
  2749. undefined.
  2750.  
  2751. Example
  2752. -------
  2753.  
  2754.      unsigned hour, min, sec, hsec;
  2755.      unsigned long ticks;
  2756.      ...
  2757.      ticks = (unsigned long)(hour * 65543.33) + (min * 1092.38) +
  2758.              (sec * 18.21) + (hsec * 0.182);
  2759.      _bios_timeofday(_TIME_SETCLOCK, &ticks);
  2760.  
  2761. 
  2762. File: libc,  Node: bioscom,  Next: biosdisk,  Prev: _bios_timeofday,  Up: Alphabetical List
  2763.  
  2764. bioscom
  2765. =======
  2766.  
  2767. Syntax
  2768. ------
  2769.  
  2770.      #include <bios.h>
  2771.      
  2772.      int bioscom(int cmd, char data, int port);
  2773.  
  2774. Description
  2775. -----------
  2776.  
  2777. This function accesses the BIOS interrupt 0x14 function, serial
  2778. communication services.  The valid values of cmd are:
  2779.  
  2780. 0 - initialize com port (DATA is the settings)
  2781. 1 - write byte to port
  2782. 2 - read byte from port
  2783. 3 - get port status
  2784.  
  2785. For initialization, the byte is made up of the following bits:
  2786.  
  2787.      0000 0000
  2788.      7654 3210  Meaning
  2789.      
  2790.      ---- --10  7 bits/character
  2791.      ---- --11  8 bits/character
  2792.      ---- -0--  1 stop bit
  2793.      ---- -1--  2 stop bits
  2794.      ---X 0---  no parity
  2795.      ---0 1---  odd parity
  2796.      ---1 1---  even parity
  2797.      000- ----  110 baud
  2798.      001- ----  150 baud
  2799.      010- ----  300 baud
  2800.      011- ----  600 baud
  2801.      100- ----  1200 baud
  2802.      101- ----  2400 baud
  2803.      110- ----  4800 baud
  2804.      111- ----  9600 baud
  2805.  
  2806. Return Value
  2807. ------------
  2808.  
  2809. The return value is a sequence of bits that indicate the port status
  2810. and, for cmd=0 and 3, the modem status.  For read/write operations, the
  2811. lower eight bits are the character read.
  2812.  
  2813.      1111 1100 0000 0000
  2814.      5432 1098 7654 3210  Meaning
  2815.      
  2816.      ---- ---- ---- ---1  CTS change
  2817.      ---- ---- ---- --1-  DSR change
  2818.      ---- ---- ---- -1--  ring change
  2819.      ---- ---- ---- 1---  carrier detect change
  2820.      ---- ---- ---1 ----  CTS present
  2821.      ---- ---- --1- ----  DSR present
  2822.      ---- ---- -1-- ----  ring present
  2823.      ---- ---- 1--- ----  carrier detect
  2824.      ---- ---1 ---- ----  data ready
  2825.      ---- --1- ---- ----  overrun error
  2826.      ---- -1-- ---- ----  parity error
  2827.      ---- 1--- ---- ----  framing error
  2828.      ---1 ---- ---- ----  break detected
  2829.      --1- ---- ---- ----  transmit holding register empty
  2830.      -1-- ---- ---- ----  transmit shift register empty
  2831.      1--- ---- ---- ----  time out (=1 if error present for cmd=1,2)
  2832.  
  2833. Example
  2834. -------
  2835.  
  2836.      bioscom(0, 0xe3); /* 9600 baud, no parity, one stop, 8 bits */
  2837.      for (i=0; buf[i]; i++)
  2838.        bioscom(1, buf[i]);
  2839.  
  2840. 
  2841. File: libc,  Node: biosdisk,  Next: biosequip,  Prev: bioscom,  Up: Alphabetical List
  2842.  
  2843. biosdisk
  2844. ========
  2845.  
  2846. Syntax
  2847. ------
  2848.  
  2849.      #include <bios.h>
  2850.      
  2851.      int biosdisk(int cmd, int drive, int head, int track,
  2852.               int sector, int nsects, void *buffer);
  2853.  
  2854. Description
  2855. -----------
  2856.  
  2857. This function interfaces with the BIOS disk sevice (interrupt 0x13).
  2858. Please refer to a BIOS reference manual for detailed information about
  2859. the parameters of this call.  All known calls are supported.  A sector
  2860. size of 512 bytes is assumed.
  2861.  
  2862. 0 - reset disk subsystem
  2863. 1 - get disk subsystem status
  2864. 2 - read one or more sectors
  2865. 3 - write one or more sectors
  2866. 5 - format a track
  2867. 6 - format back track
  2868. 7 - format drive
  2869. 8 - get drive parameters
  2870. 9 - initialize drive parameters
  2871. 10 - read long sectors
  2872. 11 - write long sectors
  2873. 12 - seek to cylinder
  2874. 13 - alternate fixed disk reset
  2875. 14 - read test buffer
  2876. 15 - write test buffer
  2877. 16 - test for drive ready
  2878. 17 - recalibrate drive
  2879. 18 - controller RAM diagnostic
  2880. 19 - controller drive diagnostic
  2881. 20 - controller internal diagnostic
  2882. 15 - read fixed disk type
  2883. 22 - read disk change line status
  2884. 23 - set DASD type (pass dasd in NSECTS)
  2885. 24 - set media type for format
  2886.  
  2887. The first request with more sectors than will fit in the transfer
  2888. buffer will cause a DOS buffer to be allocated.  This buffer is
  2889. automatically freed when your application exits.  Since this buffer is
  2890. big enough to hold 18 sectors, requests for more sectors than that will
  2891. fail.
  2892.  
  2893. Request eight returns values in buffer as follows:
  2894.  
  2895. byte 0 = sectors per track (bits 0..5) and top two bits of cylinder (in bits 6..7)
  2896. byte 1 = cyliders (bits 0..7)
  2897. byte 2 = number of drives
  2898. byte 3 = number of heads
  2899.  
  2900. Return Value
  2901. ------------
  2902.  
  2903. The value of AH returned by the BIOS.
  2904.  
  2905. Example
  2906. -------
  2907.  
  2908.      char buffer[512];
  2909.      if (biosdisk(2, 0x80, 0, 0, 0, 1, buffer))
  2910.        error("disk");
  2911.  
  2912. 
  2913. File: libc,  Node: biosequip,  Next: bioskey,  Prev: biosdisk,  Up: Alphabetical List
  2914.  
  2915. biosequip
  2916. =========
  2917.  
  2918. Syntax
  2919. ------
  2920.  
  2921.      #include <bios.h>
  2922.      
  2923.      int biosequip(void);
  2924.  
  2925. Description
  2926. -----------
  2927.  
  2928. This function returns the equipment word from BIOS request 0x11.  The
  2929. bits correspond to the following values:
  2930.  
  2931.      1111 1100 0000 0000
  2932.      5432 1098 7654 3210  Meaning
  2933.      
  2934.      ---- ---- ---- ---X  1 = disk drive(s) installed
  2935.      ---- ---- ---- --X-  1 = math coprocessor installed
  2936.      ---- ---- ---- XX--  System memory 00=16k 01=32k 10=48k 11=64k (non PS/2)
  2937.      ---- ---- ---- -X--  1 = pointing device installed (PS/2)
  2938.      ---- ---- ---- X---  not used on PS/2
  2939.      ---- ---- --XX ----  initial video mode: 01=CO40 10=CO80 11=MONO
  2940.      ---- ---- XX-- ----  disk drives 00=1 01=2 10=3 11=4 (zero if bit 1=0)
  2941.      ---- ---X ---- ----  1 = no DMA available
  2942.      ---- XXX- ---- ----  number of serial ports installed (000=0 001=1 etc)
  2943.      ---X ---- ---- ----  1 = game port adapter installed
  2944.      --X- ---- ---- ----  1 = internal modem installed (PS/2)
  2945.      --X- ---- ---- ----  1 = serial printer attached (non PS/2)
  2946.      XX-- ---- ---- ----  number of printers installed (00=0 01=1 10=2 11=3)
  2947.  
  2948. Return Value
  2949. ------------
  2950.  
  2951. The equipment word.
  2952.  
  2953. Example
  2954. -------
  2955.  
  2956.      if (biosequip() & 0xc000)
  2957.        do_printing();
  2958.  
  2959. 
  2960. File: libc,  Node: bioskey,  Next: biosmemory,  Prev: biosequip,  Up: Alphabetical List
  2961.  
  2962. bioskey
  2963. =======
  2964.  
  2965. Syntax
  2966. ------
  2967.  
  2968.      #include <bios.h>
  2969.      
  2970.      int bioskey(int command)
  2971.  
  2972. Description
  2973. -----------
  2974.  
  2975. COMMAND = 0
  2976.      Returns the next key pressed
  2977.  
  2978. COMMAND = 1
  2979.      Checks the keyboard, returns zero if no key pressed, else the key.
  2980.      Does not dequeue the key.
  2981.  
  2982. COMMAND = 2
  2983.      Returns the shift state:
  2984.  
  2985.           7654 3210  Meaning
  2986.           
  2987.           ---- ---X  Right shift key down
  2988.           ---- --X-  Left shift key down
  2989.           ---- -X--  Ctrl key down
  2990.           ---- X---  Alt key down
  2991.           ---X ----  Scroll lock on
  2992.           --X- ----  Num lock on
  2993.           -X-- ----  Caps lock on
  2994.           X--- ----  Insert on
  2995.  
  2996. Return Value
  2997. ------------
  2998.  
  2999. Depends on COMMAND.
  3000.  
  3001. Example
  3002. -------
  3003.  
  3004.      while (!bioskey(1))
  3005.        do_stuff();
  3006.  
  3007. 
  3008. File: libc,  Node: biosmemory,  Next: biosprint,  Prev: bioskey,  Up: Alphabetical List
  3009.  
  3010. biosmemory
  3011. ==========
  3012.  
  3013. Syntax
  3014. ------
  3015.  
  3016.      #include <bios.h>
  3017.      
  3018.      unsigned biosmemory(void);
  3019.  
  3020. Description
  3021. -----------
  3022.  
  3023. This function returns the amount of system memory in 1k blocks.
  3024.  
  3025. Note that this function will return 65535 if the system has more than
  3026. 64M of memory.  This is a limitation of the BIOS.
  3027.  
  3028. Return Value
  3029. ------------
  3030.  
  3031. Bytes of memory / 1024.
  3032.  
  3033. Example
  3034. -------
  3035.  
  3036.      printf("This system has %d bytes of memory\n", biosmemory()*1024);
  3037.  
  3038. 
  3039. File: libc,  Node: biosprint,  Next: biostime,  Prev: biosmemory,  Up: Alphabetical List
  3040.  
  3041. biosprint
  3042. =========
  3043.  
  3044. Syntax
  3045. ------
  3046.  
  3047.      #include <stdio.h>
  3048.      
  3049.      int biosprint(int cmd, int byte, int port)
  3050.  
  3051. Description
  3052. -----------
  3053.  
  3054. COMMAND = 0
  3055.      `byte' is sent to parallel port PORT.
  3056.  
  3057. COMMAND = 1
  3058.      Parallel port PORT is reset and initialized.
  3059.  
  3060. COMMAND = 2
  3061.      The status of parallel port PORT is returned.
  3062.  
  3063.           7654 3210  Meaning
  3064.           
  3065.           ---- ---X  Timeout
  3066.           ---- -XX-  Unused
  3067.           ---- X---  I/O Error
  3068.           ---X ----  Selected
  3069.           --X- ----  Out of paper
  3070.           -X-- ----  Acknowledged
  3071.           X--- ----  Idle
  3072.  
  3073. Return Value
  3074. ------------
  3075.  
  3076. The printer status.
  3077.  
  3078. Example
  3079. -------
  3080.  
  3081.      while (*c)
  3082.        biosprint(0, *c++, 0);
  3083.  
  3084. 
  3085. File: libc,  Node: biostime,  Next: brk,  Prev: biosprint,  Up: Alphabetical List
  3086.  
  3087. biostime
  3088. ========
  3089.  
  3090. Syntax
  3091. ------
  3092.  
  3093.      #include <bios.h>
  3094.      
  3095.      long biostime(int cmd, long newtime);
  3096.  
  3097. Description
  3098. -----------
  3099.  
  3100. This function reads (CMD=0) or sets (CMD=1) the internal tick counter,
  3101. which is the number of 18.2 Hz ticks since midnight.
  3102.  
  3103. Return Value
  3104. ------------
  3105.  
  3106. When reading, the number of ticks since midnight.
  3107.  
  3108. Example
  3109. -------
  3110.  
  3111.      long ticks = biostime(0, 0);
  3112.  
  3113. 
  3114. File: libc,  Node: brk,  Next: bsearch,  Prev: biostime,  Up: Alphabetical List
  3115.  
  3116. brk
  3117. ===
  3118.  
  3119. Syntax
  3120. ------
  3121.  
  3122.      #include <stdlib.h>
  3123.      
  3124.      int brk(void *ptr);
  3125.  
  3126. Description
  3127. -----------
  3128.  
  3129. This function changes the *break* for the program.  This is the first
  3130. address that, if referenced, will cause a fault to occur.  The program
  3131. asks for more memory by specifying larger values for PTR.  Normally,
  3132. this is done transparently through the `malloc' function.
  3133.  
  3134. Return Value
  3135. ------------
  3136.  
  3137. zero if the break was changed, -1 if not.  ERRNO is set to the error.
  3138.  
  3139. Example
  3140. -------
  3141.  
  3142.      if (brk(old_brk+1000))
  3143.        printf("no memory\n");
  3144.  
  3145. 
  3146. File: libc,  Node: bsearch,  Next: bzero,  Prev: brk,  Up: Alphabetical List
  3147.  
  3148. bsearch
  3149. =======
  3150.  
  3151. Syntax
  3152. ------
  3153.  
  3154.      #include <stdlib.h>
  3155.      
  3156.      void *bsearch (const void *key, const void *base, size_t num,
  3157.        size_t size, int (*ptf)(const void *ckey, const void *celem));
  3158.  
  3159. Description
  3160. -----------
  3161.  
  3162. Given an array of values, perform a binary search on the values looking
  3163. for value that "matches" the given key.  A match is determined by
  3164. calling the provided function PTF and passing it the key as CKEY and a
  3165. pointer to one of the elements of the array as CELEM.  This function
  3166. must return a negative number if the key is closer than the element to
  3167. the beginning of the array, positive if it is closer to the end, and
  3168. zero if the element matches the key.
  3169.  
  3170. The array begins at address BASE and contains NUM elements, each of
  3171. size SIZE.
  3172.  
  3173. Return Value
  3174. ------------
  3175.  
  3176. Returns a pointer to the element that matches the key, else NULL.
  3177.  
  3178. Example
  3179. -------
  3180.  
  3181.      typedef struct {
  3182.        int a, b;
  3183.      } q;
  3184.      
  3185.      int compare(void *key, void *elem)
  3186.      {
  3187.        return *(int *)key - ((q *)elem)->a;
  3188.      }
  3189.      
  3190.      q qlist[100];
  3191.      
  3192.      ...
  3193.      q *match = bsearch(4, qlist, 100, sizeof(q), compare);
  3194.      printf("4->%d=n", match->b);
  3195.      ...
  3196.  
  3197. 
  3198. File: libc,  Node: bzero,  Next: calloc,  Prev: bsearch,  Up: Alphabetical List
  3199.  
  3200. bzero
  3201. =====
  3202.  
  3203. Syntax
  3204. ------
  3205.  
  3206.      #include <string.h>
  3207.      
  3208.      void bzero(void *pointer, int length);
  3209.  
  3210. Description
  3211. -----------
  3212.  
  3213. The data at POINTER is filled with LENGTH zeros.
  3214.  
  3215. Return Value
  3216. ------------
  3217.  
  3218. None.
  3219.  
  3220. Example
  3221. -------
  3222.  
  3223.      char foo[100];
  3224.      bzero(foo,100);
  3225.  
  3226. 
  3227. File: libc,  Node: calloc,  Next: ceil,  Prev: bzero,  Up: Alphabetical List
  3228.  
  3229. calloc
  3230. ======
  3231.  
  3232. Syntax
  3233. ------
  3234.  
  3235.      #include <malloc.h>
  3236.      
  3237.      void *calloc(size_t num_elements, size_t size);
  3238.  
  3239. Description
  3240. -----------
  3241.  
  3242. This function allocates enough memory for NUM_ELEMENTS objects of size
  3243. SIZE.  The memory returned is initialized to all zeros.  The pointer
  3244. returned should later be passed to free (*note free::.) so that the
  3245. memory can be returned to the heap.
  3246.  
  3247. You may use cfree (*note xfree::.) to free the pointer also; it just
  3248. calls free.
  3249.  
  3250. Return Value
  3251. ------------
  3252.  
  3253. A pointer to the memory, or `NULL' if no more memory is available.
  3254.  
  3255. Example
  3256. -------
  3257.  
  3258.      Complex *x = calloc(12, sizeof(Complex));
  3259.      cfree(x);
  3260.  
  3261. 
  3262. File: libc,  Node: ceil,  Next: cfree,  Prev: calloc,  Up: Alphabetical List
  3263.  
  3264. ceil
  3265. ====
  3266.  
  3267. Syntax
  3268. ------
  3269.  
  3270.      #include <math.h>
  3271.      
  3272.      double ceil(double x);
  3273.  
  3274. Return Value
  3275. ------------
  3276.  
  3277. The smallest integer value greater than or equal to X.
  3278.  
  3279. 
  3280. File: libc,  Node: cfree,  Next: cgets,  Prev: ceil,  Up: Alphabetical List
  3281.  
  3282. cfree
  3283. =====
  3284.  
  3285. Syntax
  3286. ------
  3287.  
  3288.      #include <stdlib.h>
  3289.      
  3290.      void cfree(void *pointer);
  3291.  
  3292. Description
  3293. -----------
  3294.  
  3295. This function returns the memory allocated by calloc (*note calloc::.)
  3296. to the heap.
  3297.  
  3298. Return Value
  3299. ------------
  3300.  
  3301. None.
  3302.  
  3303. Example
  3304. -------
  3305.  
  3306.      Complex *x = calloc(12, sizeof(Complex));
  3307.      cfree(x);
  3308.  
  3309. 
  3310. File: libc,  Node: cgets,  Next: chdir,  Prev: cfree,  Up: Alphabetical List
  3311.  
  3312. cgets
  3313. =====
  3314.  
  3315. Syntax
  3316. ------
  3317.  
  3318.      #include <conio.h>
  3319.      
  3320.      char *cgets(char *_str);
  3321.  
  3322. Description
  3323. -----------
  3324.  
  3325. Get a string from the console.  This will take advantage of any
  3326. command-line editing TSRs.  To use, you must pre-fill the first
  3327. character of the buffer.  The first character is the size of the
  3328. buffer.  On return, the second character is the number of characters
  3329. read.  The third character is the first character read.
  3330.  
  3331. Return Value
  3332. ------------
  3333.  
  3334. A pointer to the first character read.
  3335.  
  3336. 
  3337. File: libc,  Node: chdir,  Next: chmod,  Prev: cgets,  Up: Alphabetical List
  3338.  
  3339. chdir
  3340. =====
  3341.  
  3342. Syntax
  3343. ------
  3344.  
  3345.      #include <unistd.h>
  3346.      
  3347.      int chdir(const char *new_directory);
  3348.  
  3349. Description
  3350. -----------
  3351.  
  3352. This function changes the current directory to NEW_DIRECTORY.  If a
  3353. drive letter is specified, the current directory for that drive is
  3354. changed and the current disk is set to that drive, else the current
  3355. directory for the current drive is changed.
  3356.  
  3357. Return Value
  3358. ------------
  3359.  
  3360. Zero if the new directory exists, else nonzero and ERRNO set if error.
  3361.  
  3362. Example
  3363. -------
  3364.  
  3365.      if (chdir("/tmp"))
  3366.        perror("/tmp");
  3367.  
  3368. 
  3369. File: libc,  Node: chmod,  Next: _chmod,  Prev: chdir,  Up: Alphabetical List
  3370.  
  3371. chmod
  3372. =====
  3373.  
  3374. Syntax
  3375. ------
  3376.  
  3377.      #include <sys/stat.h>
  3378.      
  3379.      int chmod(const char *path, mode_t mode);
  3380.  
  3381. Description
  3382. -----------
  3383.  
  3384. This function changes the mode (writable or write-only) of the specified
  3385. file.  The value of MODE can be a combination of one or more of the
  3386. following:
  3387.  
  3388. `S_IRUSR'
  3389.      Make the file readable
  3390.  
  3391. `S_IWUSR'
  3392.      Make the file writable
  3393.  
  3394. Other `S_I*' values could be included, but they will be ignored.
  3395.  
  3396. Return Value
  3397. ------------
  3398.  
  3399. Zero if the file exists and the mode was changed, else nonzero.
  3400.  
  3401. Example
  3402. -------
  3403.  
  3404.      chmod("/tmp/dj.dat", S_IWUSR|S_IRUSR);
  3405.  
  3406. 
  3407. File: libc,  Node: _chmod,  Next: chown,  Prev: chmod,  Up: Alphabetical List
  3408.  
  3409. _chmod
  3410. ======
  3411.  
  3412. Syntax
  3413. ------
  3414.  
  3415.      #include <io.h>
  3416.      
  3417.      int _chmod(const char *filename, int func, mode_t mode);
  3418.  
  3419. Description
  3420. -----------
  3421.  
  3422. This is a direct connection to the MS-DOS chmod function call, int
  3423. 0x21, %ax = 0x4300/0x4301.  If FUNC is 0, then DOS is called with AX =
  3424. 0x4300, which returns an attribute byte of a file.  If FUNC is 1, then
  3425. the attributes of a file are set as specified in MODE.  Note that the
  3426. directory and volume attribute bits must always be 0 when `_chmod()' is
  3427. called with FUNC = 1, or else the call will fail.  The third argument
  3428. is optional when getting attributes.  The attribute bits are defined as
  3429. follows:
  3430.  
  3431.        Bit       Meaning
  3432.      76543210
  3433.      .......1    Read-only
  3434.      ......1.    Hidden
  3435.      .....1..    System
  3436.      ....1...    Volume Label
  3437.      ...1....    Directory
  3438.      ..1.....    Archive
  3439.      xx......    Reserved (used by some network redirectors)
  3440.  
  3441. Return Value
  3442. ------------
  3443.  
  3444. If the file exists, `_chmod()' returns its attribute byte in case it
  3445. succeded, or -1 in case of failure.
  3446.  
  3447. 
  3448. File: libc,  Node: chown,  Next: chsize,  Prev: _chmod,  Up: Alphabetical List
  3449.  
  3450. chown
  3451. =====
  3452.  
  3453. Syntax
  3454. ------
  3455.  
  3456.      #include <unistd.h>
  3457.      
  3458.      int chown(const char *file, int owner, int group);
  3459.  
  3460. Description
  3461. -----------
  3462.  
  3463. This function does nothing under MS-DOS
  3464.  
  3465. Return Value
  3466. ------------
  3467.  
  3468. This function always returns zero if the file exists, else it returns
  3469. -1 and sets ERRNO to `ENOENT'.
  3470.  
  3471. 
  3472. File: libc,  Node: chsize,  Next: _clear87,  Prev: chown,  Up: Alphabetical List
  3473.  
  3474. chsize
  3475. ======
  3476.  
  3477. Syntax
  3478. ------
  3479.  
  3480.      #include <io.h>
  3481.      
  3482.      int chsize(int handle, long size);
  3483.  
  3484. Description
  3485. -----------
  3486.  
  3487. Just calls ftruncate (*note ftruncate::.).
  3488.  
  3489. Return Value
  3490. ------------
  3491.  
  3492. Zero on success, -1 on failure.
  3493.  
  3494. 
  3495. File: libc,  Node: _clear87,  Next: clearerr,  Prev: chsize,  Up: Alphabetical List
  3496.  
  3497. _clear87
  3498. ========
  3499.  
  3500. Syntax
  3501. ------
  3502.  
  3503.      #include <float.h>
  3504.      
  3505.      unsigned int _clear87(void);
  3506.  
  3507. Description
  3508. -----------
  3509.  
  3510. Clears the floating point processor's exception flags.
  3511.  
  3512. Return Value
  3513. ------------
  3514.  
  3515. The previous status word.
  3516.  
  3517. 
  3518. File: libc,  Node: clearerr,  Next: clock,  Prev: _clear87,  Up: Alphabetical List
  3519.  
  3520. clearerr
  3521. ========
  3522.  
  3523. Syntax
  3524. ------
  3525.  
  3526.      #include <stdio.h>
  3527.      
  3528.      void clearerr(FILE *stream);
  3529.  
  3530. Description
  3531. -----------
  3532.  
  3533. This function clears the EOF and error indicators for the file STREAM.
  3534.  
  3535. Return Value
  3536. ------------
  3537.  
  3538. None.
  3539.  
  3540. Example
  3541. -------
  3542.  
  3543.      clearerr(stdout);
  3544.  
  3545. 
  3546. File: libc,  Node: clock,  Next: close,  Prev: clearerr,  Up: Alphabetical List
  3547.  
  3548. clock
  3549. =====
  3550.  
  3551. Syntax
  3552. ------
  3553.  
  3554.      #include <time.h>
  3555.      
  3556.      clock_t clock(void);
  3557.  
  3558. Description
  3559. -----------
  3560.  
  3561. This function returns the number of clock ticks since an arbitrary time,
  3562. actually, since the first call to `clock', which itself returns zero.
  3563. The number of tics per second is CLOCKS_PER_SEC.
  3564.  
  3565. Return Value
  3566. ------------
  3567.  
  3568. The number of tics.
  3569.  
  3570. Example
  3571. -------
  3572.  
  3573.      printf("%d seconds have elapsed\n", clock()/CLOCKS_PER_SEC);
  3574.  
  3575. 
  3576. File: libc,  Node: close,  Next: _close,  Prev: clock,  Up: Alphabetical List
  3577.  
  3578. close
  3579. =====
  3580.  
  3581. Syntax
  3582. ------
  3583.  
  3584.      #include <unistd.h>
  3585.      
  3586.      int close(int fd);
  3587.  
  3588. Description
  3589. -----------
  3590.  
  3591. The open file associated with FD is closed.
  3592.  
  3593. Return Value
  3594. ------------
  3595.  
  3596. Zero if the file was closed, nonzero if FD was invalid or already
  3597. closed.
  3598.  
  3599. Example
  3600. -------
  3601.  
  3602.      int fd = open("data", O_RDONLY);
  3603.      close(fd);
  3604.  
  3605. 
  3606. File: libc,  Node: _close,  Next: closedir,  Prev: close,  Up: Alphabetical List
  3607.  
  3608. _close
  3609. ======
  3610.  
  3611. Syntax
  3612. ------
  3613.  
  3614.      #include <io.h>
  3615.      
  3616.      int _close(int fd);
  3617.  
  3618. Description
  3619. -----------
  3620.  
  3621. This is a direct connection to the MS-DOS close function call, int
  3622. 0x21, %ah = 0x3e.
  3623.  
  3624. Return Value
  3625. ------------
  3626.  
  3627. Zero if the file was closed, else nonzero.
  3628.  
  3629. 
  3630. File: libc,  Node: closedir,  Next: clreol,  Prev: _close,  Up: Alphabetical List
  3631.  
  3632. closedir
  3633. ========
  3634.  
  3635. Syntax
  3636. ------
  3637.  
  3638.      #include <dirent.h>
  3639.      
  3640.      int closedir(DIR *dir);
  3641.  
  3642. Description
  3643. -----------
  3644.  
  3645. This function closes a directory opened by opendir (*note opendir::.).
  3646.  
  3647. Return Value
  3648. ------------
  3649.  
  3650. Zero on success, nonzero if DIR is invalid.
  3651.  
  3652. 
  3653. File: libc,  Node: clreol,  Next: clrscr,  Prev: closedir,  Up: Alphabetical List
  3654.  
  3655. clreol
  3656. ======
  3657.  
  3658. Syntax
  3659. ------
  3660.  
  3661.      #include <conio.h>
  3662.      
  3663.      void clreol(void);
  3664.  
  3665. Description
  3666. -----------
  3667.  
  3668. Clear to end of line.
  3669.  
  3670. Return Value
  3671. ------------
  3672.  
  3673. None.
  3674.  
  3675. 
  3676. File: libc,  Node: clrscr,  Next: _conio_kbhit,  Prev: clreol,  Up: Alphabetical List
  3677.  
  3678. clrscr
  3679. ======
  3680.  
  3681. Syntax
  3682. ------
  3683.  
  3684.      #include <conio.h>
  3685.      
  3686.      void clrscr(void);
  3687.  
  3688. Description
  3689. -----------
  3690.  
  3691. Clear the entire screen.
  3692.  
  3693. 
  3694. File: libc,  Node: _conio_kbhit,  Next: _control87,  Prev: clrscr,  Up: Alphabetical List
  3695.  
  3696. _conio_kbhit
  3697. ============
  3698.  
  3699. Syntax
  3700. ------
  3701.  
  3702.      #include <conio.h>
  3703.      
  3704.      int _conio_kbhit(void);
  3705.  
  3706. Description
  3707. -----------
  3708.  
  3709. Determines whether or not a character is waiting at the keyboard.  If
  3710. there is an ungetch'd character, this function returns true.  Note that
  3711. if you include `conio.h', the *Note kbhit:: function is redefined to be
  3712. this function instead.
  3713.  
  3714. Return Value
  3715. ------------
  3716.  
  3717. Nonzero if a key is waiting, else zero.
  3718.  
  3719. 
  3720. File: libc,  Node: _control87,  Next: cos,  Prev: _conio_kbhit,  Up: Alphabetical List
  3721.  
  3722. _control87
  3723. ==========
  3724.  
  3725. Syntax
  3726. ------
  3727.  
  3728.      #include <float.h>
  3729.      
  3730.      unsigned int _control87(unsigned int newcw, unsigned int mask);
  3731.  
  3732. Description
  3733. -----------
  3734.  
  3735. Sets or resets bits in the FPU's control register.  The bits are
  3736. defined by macros in float.h, and by this table:
  3737.  
  3738.      ---- ---- --XX XXXX = MCW_EM - exception masks (1=handle exception internally, 0=fault)
  3739.      ---- ---- ---- ---X = EM_INVALID - invalid operation
  3740.      ---- ---- ---- --X- = EM_DENORMAL - denormal operand
  3741.      ---- ---- ---- -X-- = EM_ZERODIVIDE - divide by zero
  3742.      ---- ---- ---- X--- = EM_OVERFLOW - overflow
  3743.      ---- ---- ---X ---- = EM_UNDERFLOW - underflow
  3744.      ---- ---- --X- ---- = EM_INEXACT - rounding was required
  3745.      ---- --XX ---- ---- = MCW_PC - precision control
  3746.      ---- --00 ---- ---- = PC_24 - single precision
  3747.      ---- --10 ---- ---- = PC_53 - double precision
  3748.      ---- --11 ---- ---- = PC_64 - extended precision
  3749.      ---- XX-- ---- ---- = MCW_RC - rounding control
  3750.      ---- 00-- ---- ---- = RC_NEAR - round to nearest
  3751.      ---- 01-- ---- ---- = RC_DOWN - round towards -Inf
  3752.      ---- 10-- ---- ---- = RC_UP - round towards +Inf
  3753.      ---- 11-- ---- ---- = RC_CHOP - round towards zero
  3754.      ---X ---- ---- ---- = MCW_IC - infinity control (obsolete, always affine)
  3755.      ---0 ---- ---- ---- = IC_AFFINE - -Inf < +Inf
  3756.      ---1 ---- ---- ---- = IC_PROJECTIVE - -Inf == +Inf
  3757.  
  3758. Return Value
  3759. ------------
  3760.  
  3761. The previous control word.
  3762.  
  3763. 
  3764. File: libc,  Node: cos,  Next: cosh,  Prev: _control87,  Up: Alphabetical List
  3765.  
  3766. cos
  3767. ===
  3768.  
  3769. Syntax
  3770. ------
  3771.  
  3772.      #include <math.h>
  3773.      
  3774.      double cos(double x);
  3775.  
  3776. Return Value
  3777. ------------
  3778.  
  3779. The cosine of X.
  3780.  
  3781. 
  3782. File: libc,  Node: cosh,  Next: cprintf,  Prev: cos,  Up: Alphabetical List
  3783.  
  3784. cosh
  3785. ====
  3786.  
  3787. Syntax
  3788. ------
  3789.  
  3790.      #include <math.h>
  3791.      
  3792.      double cosh(double x);
  3793.  
  3794. Return Value
  3795. ------------
  3796.  
  3797. The hyperbolic cosine of X.
  3798.  
  3799. 
  3800. File: libc,  Node: cprintf,  Next: cputs,  Prev: cosh,  Up: Alphabetical List
  3801.  
  3802. cprintf
  3803. =======
  3804.  
  3805. Syntax
  3806. ------
  3807.  
  3808.      #include <conio.h>
  3809.      
  3810.      int cprintf(const char *_format, ...);
  3811.  
  3812. Description
  3813. -----------
  3814.  
  3815. Like `printf' (*note printf::.), but prints through the console, taking
  3816. into consideration window borders and text attributes.  There is
  3817. currently a 2048-byte limit on the size of each individual cprintf call.
  3818.  
  3819. Return Value
  3820. ------------
  3821.  
  3822. The number of characters written.
  3823.  
  3824. 
  3825. File: libc,  Node: cputs,  Next: creat,  Prev: cprintf,  Up: Alphabetical List
  3826.  
  3827. cputs
  3828. =====
  3829.  
  3830. Syntax
  3831. ------
  3832.  
  3833.      #include <conio.h>
  3834.      
  3835.      int cputs(const char *_str);
  3836.  
  3837. Description
  3838. -----------
  3839.  
  3840. Puts the string onto the console.  The cursor position is updated.
  3841.  
  3842. Return Value
  3843. ------------
  3844.  
  3845. zero on success.
  3846.  
  3847. 
  3848. File: libc,  Node: creat,  Next: _creat,  Prev: cputs,  Up: Alphabetical List
  3849.  
  3850. creat
  3851. =====
  3852.  
  3853. Syntax
  3854. ------
  3855.  
  3856.      #include <fcntl.h>
  3857.      #include <sys/stat.h> /* for mode definitions */
  3858.      
  3859.      int creat(const char *filename, mode_t mode);
  3860.  
  3861. Description
  3862. -----------
  3863.  
  3864. This function creates the given file and opens it for writing.  If the
  3865. file exists, it is truncated to zero size, unless it is read-only, in
  3866. which case the function fails.  If the file does not exist, it will be
  3867. created read-only if MODE does not have `S_IWUSR' set.
  3868.  
  3869. Return Value
  3870. ------------
  3871.  
  3872. A file descriptor >= 0, or a negative number on error.
  3873.  
  3874. Example
  3875. -------
  3876.  
  3877.      int fd = creat("data", S_IRUSR|S_IWUSR);
  3878.      write(fd, buf, 1024);
  3879.      close(fd);
  3880.  
  3881. 
  3882. File: libc,  Node: _creat,  Next: crlf2nl,  Prev: creat,  Up: Alphabetical List
  3883.  
  3884. _creat
  3885. ======
  3886.  
  3887. Syntax
  3888. ------
  3889.  
  3890.      #include <io.h>
  3891.      
  3892.      int _creat(const char *path, int attrib);
  3893.  
  3894. Description
  3895. -----------
  3896.  
  3897. This is a direct connection to the MS-DOS creat function call, int
  3898. 0x21, %ah = 0x3c.  The file is set to binary mode.
  3899.  
  3900. Return Value
  3901. ------------
  3902.  
  3903. The new file descriptor, else -1 on error.
  3904.  
  3905. 
  3906. File: libc,  Node: crlf2nl,  Next: __crt0_glob_function,  Prev: _creat,  Up: Alphabetical List
  3907.  
  3908. crlf2nl
  3909. =======
  3910.  
  3911. Syntax
  3912. ------
  3913.  
  3914.      size_t crlf2nl(char *buf, ssize_t len);
  3915.  
  3916. Description
  3917. -----------
  3918.  
  3919. This function removes Ctrl-M characters from the given BUF.
  3920.  
  3921. Return Value
  3922. ------------
  3923.  
  3924. The number of characters remaining in the buffer are returned.
  3925.  
  3926. 
  3927. File: libc,  Node: __crt0_glob_function,  Next: __crt0_load_environment_file,  Prev: crlf2nl,  Up: Alphabetical List
  3928.  
  3929. __crt0_glob_function
  3930. ====================
  3931.  
  3932. Syntax
  3933. ------
  3934.  
  3935.      #include <crt0.h>
  3936.      
  3937.      char **__crt0_glob_function(char *_argument);
  3938.  
  3939. Description
  3940. -----------
  3941.  
  3942. If the application wishes to provide a wildcard expansion function, it
  3943. should define a __crt0_glob_function function.  It should return a list
  3944. of the expanded values, or 0 if no expansion will occur.  The startup
  3945. code will free the returned pointer if it is nonzero.
  3946.  
  3947. If no expander function is provided, wildcards will be expanded in the
  3948. POSIX.1 style.  To disable expansion, provide a __crt0_glob_function
  3949. that always returns 0.
  3950.  
  3951. 
  3952. File: libc,  Node: __crt0_load_environment_file,  Next: __crt0_setup_arguments,  Prev: __crt0_glob_function,  Up: Alphabetical List
  3953.  
  3954. __crt0_load_environment_file
  3955. ============================
  3956.  
  3957. Syntax
  3958. ------
  3959.  
  3960.      #include <crt0.h>
  3961.      
  3962.      void   __crt0_load_environment_file(char *_app_name);
  3963.  
  3964. Description
  3965. -----------
  3966.  
  3967. This function, provided by libc.a, does all the work required to load
  3968. additional environment variables from the file $DJGPP.  If the
  3969. application does not use environment variables, the programmer can
  3970. reduce the size of the program image by providing a version of this
  3971. function that does nothing.
  3972.  
  3973. *Note __crt0_setup_arguments::.
  3974.  
  3975. 
  3976. File: libc,  Node: __crt0_setup_arguments,  Next: _crt0_startup_flags,  Prev: __crt0_load_environment_file,  Up: Alphabetical List
  3977.  
  3978. __crt0_setup_arguments
  3979. ======================
  3980.  
  3981. Syntax
  3982. ------
  3983.  
  3984.      #include <crt0.h>
  3985.      
  3986.      void   __crt0_setup_arguments(void);
  3987.  
  3988. Description
  3989. -----------
  3990.  
  3991. This function, provided by libc.a, does all the work required to
  3992. provide the two arguments passed to main() (usually `argc' and `argv').
  3993. If main() does not use these arguments, the programmer can reduce the
  3994. size of the program image by providing a version of this function that
  3995. does nothing.
  3996.  
  3997. *Note __crt0_load_environment_file::.
  3998.  
  3999. 
  4000. File: libc,  Node: _crt0_startup_flags,  Next: cscanf,  Prev: __crt0_setup_arguments,  Up: Alphabetical List
  4001.  
  4002. _crt0_startup_flags
  4003. ===================
  4004.  
  4005. Syntax
  4006. ------
  4007.  
  4008.      #include <crt0.h>
  4009.      
  4010.      int _crt0_startup_flags = ...;
  4011.  
  4012. Description
  4013. -----------
  4014.  
  4015. This variable can be used to determine what the startup code will (or
  4016. will not) do when the program begins.  This can be used to tailor the
  4017. startup environment to a particular program.
  4018.  
  4019. `_CRT0_FLAG_PRESERVE_UPPER_CASE'
  4020.      If set, argv[0] is left in whatever case it was.  If not set, all
  4021.      characters are mapped to lower case.  Note that if the argv0 field
  4022.      in the stubinfo structure is present, the case of that part of
  4023.      argv0 is not affected.
  4024.  
  4025. `_CRT0_FLAG_USE_DOS_SLASHES'
  4026.      If set, reverse slashes (dos-style) are preserved in argv[0].  If
  4027.      not set, all reverse slashes are replaced with unix-style slashes.
  4028.  
  4029. `_CRT0_FLAG_DROP_EXE_SUFFIX'
  4030.      If set, the .EXE suffix is removed from the file name component of
  4031.      argv[0].  If not set, the suffix remains.
  4032.  
  4033. `_CRT0_FLAG_DROP_DRIVE_SPECIFIER'
  4034.      If set, the drive specifier (ex: `C:') is removed from the
  4035.      beginning of argv[0] (if present).  If not set, the drive
  4036.      specifier remains.
  4037.  
  4038. `_CRT0_FLAG_DISALLOW_RESPONSE_FILES'
  4039.      If set, response files (ex: @gcc.rf) are not expanded.  If not
  4040.      set, the contents of the response files are used to create
  4041.      arguments.  Note that if the file does not exist, that argument
  4042.      remains unexpanded.
  4043.  
  4044. `_CRT0_FLAG_FILL_SBRK_MEMORY'
  4045.      If set, fill sbrk()'d memory with a constant value.  If not, memory
  4046.      gets whatever happens to have been in there, which breaks some
  4047.      applications.
  4048.  
  4049. `_CRT0_FLAG_FILL_DEADBEEF'
  4050.      If set, fill memory (above) with 0xdeadbeef, else fill with zero.
  4051.      This is especially useful for debugging uninitialized memory
  4052.      problems.
  4053.  
  4054. `_CRT0_FLAG_NEARPTR'
  4055.      If set, set DS limit to 4GB which allows use of near pointers to
  4056.      DOS (and other) memory.  WARNING, disables memory protection and
  4057.      bad pointers may crash the machine or wipe out your data.
  4058.  
  4059. `_CRT0_FLAG_NULLOK'
  4060.      If set, disable NULL pointer protection (if it can be controlled
  4061.      at all).
  4062.  
  4063. `_CRT0_FLAG_NMI_SIGNAL'
  4064.      If set, enabled capture of NMI in exception code.  This may cause
  4065.      problems with laptops and "green" boxes which use it to wake up.
  4066.      Default is to leave NMIs alone and pass through to real mode code.
  4067.      You decide.
  4068.  
  4069. `_CRT0_FLAG_NO_LFN'
  4070.      If set, disable usage of long file name functions even on systems
  4071.      (such as Win95) which support them.  This might be needed to work
  4072.      around program assumptions on file name format on programs written
  4073.      specifically for DOS.
  4074.  
  4075. `_CRT0_FLAG_NONMOVE_SBRK'
  4076.      If set, the sbrk() algorithm used used multiple DPMI memory blocks
  4077.      which makes sure the base of CS/DS/SS does not change.  This may
  4078.      cause problems with sbrk(0) values and programs with other
  4079.      assumptions about sbrk behavior.  This flag is useful with near
  4080.      pointers, since a constant pointer to DOS/Video memory can be
  4081.      computed without needing to reload it after any routine which
  4082.      might call sbrk().
  4083.  
  4084. `_CRT0_FLAG_UNIX_SBRK'
  4085.      If set, the sbrk() algorithm used resizes memory blocks so that
  4086.      the layout of memory is set up to be the most compatible with unix
  4087.      sbrk() expectations.  This mode should not be used with hardware
  4088.      interrupts, near pointers, and may cause problems with QDPMI
  4089.      virtual memory.  If your program requires a specific sbrk()
  4090.      behavior, you should set one of these flags, since the default may
  4091.      change in different libc releases.
  4092.  
  4093. `_CRT0_FLAG_LOCK_MEMORY'
  4094.      If set, locks all memory as it is allocated.  This effectively
  4095.      disables virtual memory, and may be useful if using extensive
  4096.      hardware interrupt codes in a relatively small image size.  The
  4097.      memory is locked after it is sbrk()ed, so the locking may fail.
  4098.      This bit may be set or cleared during execution.  When sbrk() uses
  4099.      multiple memory zones, it can be difficult to lock all memory
  4100.      since the memory block size and location is impossible to
  4101.      determine.
  4102.  
  4103. 
  4104. File: libc,  Node: cscanf,  Next: ctime,  Prev: _crt0_startup_flags,  Up: Alphabetical List
  4105.  
  4106. cscanf
  4107. ======
  4108.  
  4109. Syntax
  4110. ------
  4111.  
  4112.      #include <conio.h>
  4113.      
  4114.      int cscanf(const char *_format, ...);
  4115.  
  4116. Description
  4117. -----------
  4118.  
  4119. Like `scanf' (*note scanf::.), but it reads from the keyboard directly.
  4120.  
  4121. Return Value
  4122. ------------
  4123.  
  4124. The number of fields stored.
  4125.  
  4126. 
  4127. File: libc,  Node: ctime,  Next: delay,  Prev: cscanf,  Up: Alphabetical List
  4128.  
  4129. ctime
  4130. =====
  4131.  
  4132. Syntax
  4133. ------
  4134.  
  4135.      #include <time.h>
  4136.      
  4137.      char *ctime(const time_t *cal);
  4138.  
  4139. Description
  4140. -----------
  4141.  
  4142. This function returns an ASCII representation of the time in CAL.  This
  4143. is equivalent to `asctime(localtime(cal))'.  *Note asctime::.  *Note
  4144. localtime::.
  4145.  
  4146. Return Value
  4147. ------------
  4148.  
  4149. The ascii representation of the time.
  4150.  
  4151. 
  4152. File: libc,  Node: delay,  Next: delline,  Prev: ctime,  Up: Alphabetical List
  4153.  
  4154. delay
  4155. =====
  4156.  
  4157. Syntax
  4158. ------
  4159.  
  4160.      void delay(unsigned msec);
  4161.  
  4162. Description
  4163. -----------
  4164.  
  4165. This function causes the program to pause for MSEC milliseconds.  It
  4166. uses the `int 15h' delay function to relinquish the CPU to other
  4167. programs that might need it.
  4168.  
  4169. Return Value
  4170. ------------
  4171.  
  4172. None.
  4173.  
  4174. Example
  4175. -------
  4176.  
  4177.      delay(200); /* delay for 1/5 second */
  4178.  
  4179. 
  4180. File: libc,  Node: delline,  Next: difftime,  Prev: delay,  Up: Alphabetical List
  4181.  
  4182. delline
  4183. =======
  4184.  
  4185. Syntax
  4186. ------
  4187.  
  4188.      #include <conio.h>
  4189.      
  4190.      void    delline(void);
  4191.  
  4192. Description
  4193. -----------
  4194.  
  4195. The line the cursor is on is deleted; lines below it scroll up.
  4196.  
  4197. 
  4198. File: libc,  Node: difftime,  Next: disable,  Prev: delline,  Up: Alphabetical List
  4199.  
  4200. difftime
  4201. ========
  4202.  
  4203. Syntax
  4204. ------
  4205.  
  4206.      #include <time.h>
  4207.      
  4208.      double difftime(time_t t1, time_t t0);
  4209.  
  4210. Description
  4211. -----------
  4212.  
  4213. This function returns the difference in time, in seconds, from T0 to T1.
  4214.  
  4215. Return Value
  4216. ------------
  4217.  
  4218. The number of seconds.
  4219.  
  4220. Example
  4221. -------
  4222.  
  4223.      time_t t1, t0;
  4224.      double elapsed;
  4225.      time(&t0);
  4226.      do_something();
  4227.      time(&t1);
  4228.      elapsed = difftime(t1, t0);
  4229.  
  4230. 
  4231. File: libc,  Node: disable,  Next: div,  Prev: difftime,  Up: Alphabetical List
  4232.  
  4233. disable
  4234. =======
  4235.  
  4236. Syntax
  4237. ------
  4238.  
  4239.      #include <dos.h>
  4240.      
  4241.      int disable(void);
  4242.  
  4243. Description
  4244. -----------
  4245.  
  4246. This function disables interrupts.
  4247.  
  4248. *Note enable::.
  4249.  
  4250. Return Value
  4251. ------------
  4252.  
  4253. Returns nonzero if the interrupts had been enabled before this call,
  4254. zero if they were already disabled.
  4255.  
  4256. Example
  4257. -------
  4258.  
  4259.      int ints_were_enabled;
  4260.      
  4261.      ints_were_enabled = disable();
  4262.      . . . do some stuff . . .
  4263.      if (ints_were_enabled)
  4264.        enable();
  4265.  
  4266. 
  4267. File: libc,  Node: div,  Next: __djgpp_map_physical_memory,  Prev: disable,  Up: Alphabetical List
  4268.  
  4269. div
  4270. ===
  4271.  
  4272. Syntax
  4273. ------
  4274.  
  4275.      #include <stdlib.h>
  4276.      
  4277.      div_t div(int numberator, int denomonator);
  4278.  
  4279. Description
  4280. -----------
  4281.  
  4282. Returns the quotient and remainder of the division NUMBERATOR divided
  4283. by DENOMONATOR.  The return type is as follows:
  4284.  
  4285.      typedef struct {
  4286.        int quot;
  4287.        int rem;
  4288.      } div_t;
  4289.  
  4290. Return Value
  4291. ------------
  4292.  
  4293. The results of the division are returned.
  4294.  
  4295. Example
  4296. -------
  4297.  
  4298.      div_t d = div(42, 3);
  4299.      printf("42 = %d x 3 + %d\n", d.quot, d.rem);
  4300.      
  4301.      div(+40, +3) = { +13, +1 }
  4302.      div(+40, -3) = { -13, -1 }
  4303.      div(-40, +3) = { -13, -1 }
  4304.      div(-40, -3) = { +13, -1 }
  4305.  
  4306. 
  4307. File: libc,  Node: __djgpp_map_physical_memory,  Next: __djgpp_memory_handle,  Prev: div,  Up: Alphabetical List
  4308.  
  4309. __djgpp_map_physical_memory
  4310. ===========================
  4311.  
  4312. Syntax
  4313. ------
  4314.  
  4315.      #include <dpmi.h>
  4316.      
  4317.      int __djgpp_map_physical_memory(void *our_addr, unsigned long num_bytes,
  4318.                          unsigned long phys_addr);
  4319.  
  4320. Description
  4321. -----------
  4322.  
  4323. This function attempts to map a range of physical memory over the
  4324. specified addresses.  One common use of this routine is to map device
  4325. memory, such as a linear frame buffer, into the address space of the
  4326. calling program.  OUR_ADDR, NUM_BYTES, and PHYS_ADDR must be
  4327. page-aligned.  If they are not page-aligned, ERRNO will be set to
  4328. `EINVAL' and the routine will fail.
  4329.  
  4330. This routine properly handles memory ranges that span multiple DPMI
  4331. handles, while `__dpmi_map_device_in_memory_block' does not.
  4332.  
  4333. Consult DPMI documentation on function 0508H for details on how this
  4334. function works.  Note: since 0508H is a DPMI service new with DPMI 1.0,
  4335. this call will fail on most DPMI 0.9 servers.  For your program to work
  4336. on a wide range of systems, you should not assume this call will
  4337. succeed.
  4338.  
  4339. Even on failure, this routine may affect a subset of the pages
  4340. specified.
  4341.  
  4342. Return Value
  4343. ------------
  4344.  
  4345. 0 on success, -1 on failure.  On failure, ERRNO will be set to `EINVAL'
  4346. for illegal input parameters, or `EACCES' if the DPMI server rejected
  4347. the mapping request.
  4348.  
  4349. Example
  4350. -------
  4351.  
  4352.      if (__djgpp_map_physical_memory (my_page_aligned_memory, 16384, 0x40000000))
  4353.        printf ("Failed to map physical addresses!\n");
  4354.  
  4355. 
  4356. File: libc,  Node: __djgpp_memory_handle,  Next: __djgpp_memory_handle_list,  Prev: __djgpp_map_physical_memory,  Up: Alphabetical List
  4357.  
  4358. __djgpp_memory_handle
  4359. =====================
  4360.  
  4361. Syntax
  4362. ------
  4363.  
  4364.      #include <crt0.h>
  4365.      
  4366.      __djgpp_sbrk_handle *__djgpp_memory_handle(unsigned address);
  4367.  
  4368. Description
  4369. -----------
  4370.  
  4371. This function returns a pointer to a structure containing the memory
  4372. handle and program relative offset associated with the address passed.
  4373. It is just a convenient way to process the __djgpp_memory_handle_list.
  4374.  
  4375. Return Value
  4376. ------------
  4377.  
  4378. A pointer to the __djgpp_sbrk_handle associated with a particular
  4379. address.
  4380.  
  4381. 
  4382. File: libc,  Node: __djgpp_memory_handle_list,  Next: __djgpp_nearptr_disable,  Prev: __djgpp_memory_handle,  Up: Alphabetical List
  4383.  
  4384. __djgpp_memory_handle_list
  4385. ==========================
  4386.  
  4387. Syntax
  4388. ------
  4389.  
  4390.      #include <crt0.h>
  4391.      
  4392.      extern __djgpp_sbrk_handle __djgpp_memory_handle_list[256];
  4393.  
  4394. Description
  4395. -----------
  4396.  
  4397. This array contains a list of memory handles and program relative
  4398. offsets allocated by sbrk() in addition to the handle allocated by the
  4399. stub.  These values are normally not needed unless you are doing
  4400. low-level DPMI page protection or memory mapping.
  4401.  
  4402. 
  4403. File: libc,  Node: __djgpp_nearptr_disable,  Next: __djgpp_nearptr_enable,  Prev: __djgpp_memory_handle_list,  Up: Alphabetical List
  4404.  
  4405. __djgpp_nearptr_disable
  4406. =======================
  4407.  
  4408. Syntax
  4409. ------
  4410.  
  4411.      #include <sys/nearptr.h>
  4412.      
  4413.      void __djgpp_nearptr_disable(void);
  4414.  
  4415. Description
  4416. -----------
  4417.  
  4418. This function disables near pointers, and re-enables protection.  *Note
  4419. __djgpp_nearptr_enable::.
  4420.  
  4421. 
  4422. File: libc,  Node: __djgpp_nearptr_enable,  Next: __djgpp_set_page_attributes,  Prev: __djgpp_nearptr_disable,  Up: Alphabetical List
  4423.  
  4424. __djgpp_nearptr_enable
  4425. ======================
  4426.  
  4427. Syntax
  4428. ------
  4429.  
  4430.      #include <sys/nearptr.h>
  4431.      
  4432.      int __djgpp_nearptr_enable(void);
  4433.  
  4434. Description
  4435. -----------
  4436.  
  4437. This function enables "near pointers" to be used to access the DOS
  4438. memory arena.  Sort of.  When you call this function, it will return
  4439. nonzero if it has successfully enabled near pointers.  If so, you must
  4440. add the value `__djgpp_conventional_base' to the linear address of the
  4441. physical memory.  For example:
  4442.  
  4443.      if (__djgpp_nearptr_enable())
  4444.      {
  4445.        short *screen = (short *)(__djgpp_conventional_base + 0xb8000);
  4446.        for (i=0; i<80*24*2; i++)
  4447.          screen[i] = 0x0720;
  4448.        __djgpp_nearptr_disable();
  4449.      }
  4450.  
  4451. The variable `__djgpp_base_address' contains the linear base address of
  4452. the application's data segment.  You can subtract this value from other
  4453. linear addresses that DPMI functions might return in order to obtain a
  4454. near pointer to those linear regions as well.
  4455.  
  4456. If using the Unix-like sbrk algorithm, near pointers are only valid
  4457. until the next `malloc', `system', `spawn*', or `exec*' function call,
  4458. since the linear base address of the application may be changed by
  4459. these calls.
  4460.  
  4461. WARNING: When you enable near pointers, you disable all the protection
  4462. that the system is providing.  If you are not careful, your application
  4463. may destroy the data in your computer.  USE AT YOUR OWN RISK!
  4464.  
  4465. Return Value
  4466. ------------
  4467.  
  4468. Returns 0 if near pointers are not available, or nonzero if they are.
  4469.  
  4470. 
  4471. File: libc,  Node: __djgpp_set_page_attributes,  Next: _djstat_describe_lossage,  Prev: __djgpp_nearptr_enable,  Up: Alphabetical List
  4472.  
  4473. __djgpp_set_page_attributes
  4474. ===========================
  4475.  
  4476. Syntax
  4477. ------
  4478.  
  4479.      #include <dpmi.h>
  4480.      
  4481.      int __djgpp_set_page_attributes(void *our_addr, unsigned long num_bytes,
  4482.                          unsigned short attributes);
  4483.  
  4484. Description
  4485. -----------
  4486.  
  4487. This function sets the DPMI page attributes for the pages in a range of
  4488. memory.  OUR_ADDR and NUM_BYTES must be page-aligned.  If they are not
  4489. page-aligned, ERRNO will be set to `EINVAL' and the routine will fail.
  4490.  
  4491. Consult DPMI documentation on function 0507H for the meaning of the
  4492. ATTRIBUTES argument.  Note: since 0507H is a DPMI service new with DPMI
  4493. 1.0, this call will fail on most DPMI 0.9 servers.  For your program to
  4494. work on a wide range of systems, you should not assume this call will
  4495. succeed.
  4496.  
  4497. Even on failure, this routine may affect a subset of the pages
  4498. specified.
  4499.  
  4500. Return Value
  4501. ------------
  4502.  
  4503. 0 on success, -1 on failure.  On failure, ERRNO will be set to `EINVAL'
  4504. for illegal input parameters, or `EACCES' if the DPMI server rejected
  4505. the attribute setting.
  4506.  
  4507. Example
  4508. -------
  4509.  
  4510.      if (__djgpp_set_page_attributes (my_page_aligned_memory, 16384, 0))
  4511.        printf ("Failed to make pages uncommitted!\n");
  4512.  
  4513. 
  4514. File: libc,  Node: _djstat_describe_lossage,  Next: _djstat_fail_bits,  Prev: __djgpp_set_page_attributes,  Up: Alphabetical List
  4515.  
  4516. _djstat_describe_lossage
  4517. ========================
  4518.  
  4519. Syntax
  4520. ------
  4521.  
  4522.      #include <stdio.h>
  4523.      
  4524.      void _djstat_describe_lossage(FILE *fp);
  4525.  
  4526. Description
  4527. -----------
  4528.  
  4529. Accesses the global variable *Note _djstat_fail_bits:: and prints to the
  4530. stream given by FP a human-readable description of the undocumented DOS
  4531. features which the last call to `stat()' or `fstat()' failed to use.
  4532. (If FP is zero, the function prints to stderr.)  If the last call to
  4533. `f?stat()' didn't set any failure bits, an "all's well" message is
  4534. printed.  This function is designed to help in debugging these
  4535. functions in hostile environments (like DOS clones) and in adapting
  4536. them to the future DOS versions.  If you ever have any strange results
  4537. returned by `f?stat()', please call this function and post the
  4538. diagnostics it printed to the DJGPP mailing list.
  4539.  
  4540. The diagnostic messages this function prints are almost
  4541. self-explanatory.  Some explanations of terminology and abbreviations
  4542. used by the printed messages will further clarify them.
  4543.  
  4544. SDA (Swappable DOS Area) - this is an internal DOS structure.  `stat()'
  4545. uses it to get the full directory entry (including the starting cluster
  4546. number) of a file.  The pointer to SDA found by `stat()' is trusted
  4547. only if we find the pathname of our file at a specific offset in that
  4548. SDA.
  4549.  
  4550. SFT (System File Table) - another internal DOS structure, used in file
  4551. operations.  `fstat()' uses it to get full information on a file given
  4552. its handle.  An SFT entry which is found by `fstat()' is only trusted
  4553. if it contains files size and time stamp like those returned by DOS
  4554. functions 57h and 42h.  Novell NetWare 3.x traps DOS file operations in
  4555. such a way they never get to SFT, so some failure messages refer
  4556. specifically to Novell.
  4557.  
  4558. Hashing - the fall-back method of returning a unique inode number for
  4559. each file.  It is used whenever the starting cluster of a file couldn't
  4560. be reliably determined.
  4561.  
  4562. Return Value
  4563. ------------
  4564.  
  4565. None.
  4566.  
  4567. Example
  4568. -------
  4569.  
  4570.        if (stat(path, &stat_buf))
  4571.          _djstat_describe_lossage((FILE *)0);
  4572.  
  4573. 
  4574. File: libc,  Node: _djstat_fail_bits,  Next: _djstat_flags,  Prev: _djstat_describe_lossage,  Up: Alphabetical List
  4575.  
  4576. _djstat_fail_bits
  4577. =================
  4578.  
  4579. Syntax
  4580. ------
  4581.  
  4582.      #include <sys/stat.h>
  4583.      
  4584.      extern unsigned short   _djstat_fail_bits;
  4585.  
  4586. As proper operation of *Note stat:: and *Note fstat:: depend on
  4587. undocumented DOS features, they could fail in some incompatible
  4588. environment or a future DOS version.  If they do, the
  4589. `_djstat_fail_bits' variable will have some of its bits set.  Each bit
  4590. describes a single feature which was used and failed.  The function
  4591. *Note _djstat_describe_lossage:: may be called to print a
  4592. human-readable description of the bits which were set by the last call
  4593. to `f?stat()'.  This should make debugging `f?stat()' failures in an
  4594. unanticipated environment a lot easier.
  4595.  
  4596. The following bits are currently defined:
  4597.  
  4598. `_STFAIL_SDA'
  4599.      Indicates that Get SDA call failed.
  4600.  
  4601. `_STFAIL_OSVER'
  4602.      Indicates an unsupported DOS version (less than 3.10 for `stat()'
  4603.      or less than 2.0 for `fstat()').
  4604.  
  4605. `_STFAIL_BADSDA'
  4606.      The pointer to SDA was found to be bogus.
  4607.  
  4608. `_STFAIL_TRUENAME'
  4609.      Indicates that *Note _truename:: function call failed.
  4610.  
  4611. `_STFAIL_HASH'
  4612.      Indicates that the starting cluster of the file is unavailable,
  4613.      and inode number was computed by hashing its name.
  4614.  
  4615. `_STFAIL_LABEL'
  4616.      The application requested the time stamp of a root dir, but no
  4617.      volume label was found.
  4618.  
  4619. `_STFAIL_DCOUNT'
  4620.      The number of SDA reported is ridiculously large (probbaly an
  4621.      unsupported DOS clone).
  4622.  
  4623. `_STFAIL_WRITEBIT'
  4624.      `fstat()' was asked to get write access bit of a file, but
  4625.      couldn't.
  4626.  
  4627. `_STFAIL_DEVNO'
  4628.      `fstat()' failed to get device number.
  4629.  
  4630. `_STFAIL_BADSFT'
  4631.      An SFT entry for this file was found by `fstat()', but its contents
  4632.      can't be trusted because it didn't match file size and time stamp
  4633.      as reported by DOS.
  4634.  
  4635. `_STFAIL_SFTIDX'
  4636.      The SFT index in Job File Table in program's PSP is negative.
  4637.  
  4638. `_STFAIL_SFTNF'
  4639.      The file entry was not found in the SFT array.
  4640.  
  4641. Below are some explanations of terminology and abbreviations used by the
  4642. printed messages, which will further clarify the meaning of the above
  4643. bits and their descriptions printed by *Note _djstat_describe_lossage::.
  4644.  
  4645. SDA (Swappable DOS Area) - this is an internal DOS structure.  `stat()'
  4646. uses it to get the full directory entry (including the starting cluster
  4647. number) of a file.  The pointer to SDA found by `stat()' is trusted
  4648. only if we find the pathname of our file at a specific offset in that
  4649. SDA.
  4650.  
  4651. SFT (System File Table) - another internal DOS structure, used in file
  4652. operations.  `fstat()' uses it to get full information on a file given
  4653. its handle.  An SFT entry which is found by `fstat()' is only trusted
  4654. if it contains files size and time stamp like those returned by DOS
  4655. functions 57h and 42h.  Novell NetWare 3.x traps DOS file operations in
  4656. such a way they never get to SFT, so some failure messages refer
  4657. specifically to Novell.
  4658.  
  4659. Hashing - the fall-back method of returning a unique inode number for
  4660. each file.  It is used whenever the starting cluster of a file couldn't
  4661. be reliably determined.
  4662.  
  4663. 
  4664. File: libc,  Node: _djstat_flags,  Next: _doprnt,  Prev: _djstat_fail_bits,  Up: Alphabetical List
  4665.  
  4666. _djstat_flags
  4667. =============
  4668.  
  4669. Syntax
  4670. ------
  4671.  
  4672.      #include <sys/stat.h>
  4673.      
  4674.      extern unsigned short   _djstat_flags;
  4675.  
  4676. This variable contains bits for some fields of struct stat which are
  4677. expensive to compute under DOS.  Any such computation is only done by
  4678. *Note stat:: or *Note fstat:: if the corresponding bit in
  4679. `_djstat_flags' is cleared.  By default, all the bits are cleared, so
  4680. applications which don't care, automagically get a full version,
  4681. possibly at a price of performance.  To get the fastest possible
  4682. `f?stat()' for your application, clear only the bits which you need and
  4683. set all the others.
  4684.  
  4685. The following bits are currently defined:
  4686.  
  4687. `_STAT_INODE'
  4688.      Causes `f?stat()' to compute the `st_ino' (inode number) field.
  4689.  
  4690. `_STAT_EXEC_EXT'
  4691.      Tells `f?stat()' to compute the execute access bit from extension.
  4692.  
  4693. `_STAT_EXEC_MAGIC'
  4694.      Tells `f?stat()' to compute the execute access bit from magic
  4695.      signature (the first two bytes of the file, see *Note
  4696.      _is_executable::.  Note that if _STAT_EXEC_MAGIC is set, but
  4697.      _STAT_EXEC_EXT is not, some files which shouldn't be flagged as
  4698.      executables (e.g., COFF *.o object files) will have their execute
  4699.      bit set, because they have the magic number signature at their
  4700.      beginning.  Therefore, only use the above combination if you want
  4701.      to debug the list of extensions provided in is_exec.c file.
  4702.  
  4703. `_STAT_DIRSIZE'
  4704.      Causes `stat' to compute directory size by counting the number of
  4705.      its entries (unless some friendly network redirector brought a
  4706.      true directory size with it).
  4707.  
  4708. `_STAT_ROOT_TIME'
  4709.      Causes `stat()' to try to get time stamp of root directory from its
  4710.      volume label entry, if there is one.
  4711.  
  4712. `_STAT_WRITEBIT'
  4713.      Tells `fstat()' that file's write access bit is required (this
  4714.      could be a problem only under some versions of Novell Netware).
  4715.  
  4716. Note that if you set a bit, some failure bits in *Note
  4717. _djstat_fail_bits:: might not be set, because some computations which
  4718. report failures are only done when they are required.
  4719.  
  4720. 
  4721. File: libc,  Node: _doprnt,  Next: _dos_close,  Prev: _djstat_flags,  Up: Alphabetical List
  4722.  
  4723. _doprnt
  4724. =======
  4725.  
  4726. Syntax
  4727. ------
  4728.  
  4729.      #include <stdio.h>
  4730.      
  4731.      int _doprnt(const char *format, void *params, FILE *file);
  4732.  
  4733. Description
  4734. -----------
  4735.  
  4736. This is an internal function that is used by all the `printf' style
  4737. functions, which simply pass their format, arguments, and stream to this
  4738. function.
  4739.  
  4740. *Note printf:: for a discussion of the allowed formats and arguments.
  4741.  
  4742. Return Value
  4743. ------------
  4744.  
  4745. The number of characters generated is returned.
  4746.  
  4747. Example
  4748. -------
  4749.  
  4750.      int args[] = { 1, 2, 3, 66 };
  4751.      _doprnt("%d %d %d %c\n", args, stdout);
  4752.  
  4753. 
  4754. File: libc,  Node: _dos_close,  Next: _dos_commit,  Prev: _doprnt,  Up: Alphabetical List
  4755.  
  4756. _dos_close
  4757. ==========
  4758.  
  4759. Syntax
  4760. ------
  4761.  
  4762.      #include <dos.h>
  4763.      
  4764.      unsigned int _dos_close(int handle);
  4765.  
  4766. Description
  4767. -----------
  4768.  
  4769. This is a direct connection to the MS-DOS close function call (%ah =
  4770. 0x3E).  This function closes the specified file.
  4771.  
  4772. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  4773. _dos_read::. *Note _dos_write::.
  4774.  
  4775. Return Value
  4776. ------------
  4777.  
  4778. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  4779.  
  4780. Example
  4781. -------
  4782.  
  4783.      int handle;
  4784.      
  4785.      _dos_creat("FOO.DAT", _A_ARCH, &handle);
  4786.      ...
  4787.      _dos_close(handle);
  4788.  
  4789. 
  4790. File: libc,  Node: _dos_commit,  Next: _dos_creat,  Prev: _dos_close,  Up: Alphabetical List
  4791.  
  4792. _dos_commit
  4793. ===========
  4794.  
  4795. Syntax
  4796. ------
  4797.  
  4798.      #include <dos.h>
  4799.      
  4800.      unsigned int _dos_commit(int handle);
  4801.  
  4802. Description
  4803. -----------
  4804.  
  4805. This is a direct connection to the MS-DOS commit function call (%ah =
  4806. 0x68).  This function flushes DOS internal file buffers to disk.
  4807.  
  4808. Return Value
  4809. ------------
  4810.  
  4811. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  4812.  
  4813. Example
  4814. -------
  4815.  
  4816.      _dos_write(handle, buffer, 1000, &result);
  4817.      _dos_commit(handle);
  4818.      _dos_close(handle);
  4819.  
  4820. 
  4821. File: libc,  Node: _dos_creat,  Next: _dos_creatnew,  Prev: _dos_commit,  Up: Alphabetical List
  4822.  
  4823. _dos_creat
  4824. ==========
  4825.  
  4826. Syntax
  4827. ------
  4828.  
  4829.      #include <dos.h>
  4830.      
  4831.      unsigned int _dos_creat(const char *filename, unsigned short attr, int *handle);
  4832.  
  4833. Description
  4834. -----------
  4835.  
  4836. This is a direct connection to the MS-DOS creat function call (%ah =
  4837. 0x3C).  This function creates the given file with the given attribute
  4838. and puts file handle into HANDLE if creating is successful. If the file
  4839. already exists it truncates the file to zero length. Meaning of ATTR
  4840. parameter is the following:
  4841.  
  4842. `_A_NORMAL (0x00)'
  4843.      Normal file (no read/write restrictions)
  4844.  
  4845. `_A_RDONLY (0x01)'
  4846.      Read only file
  4847.  
  4848. `_A_HIDDEN (0x02)'
  4849.      Hidden file
  4850.  
  4851. `_A_SYSTEM (0x04)'
  4852.      System file
  4853.  
  4854. `_A_ARCH (0x20)'
  4855.      Archive file
  4856.  
  4857. *Note _dos_open::. *Note _dos_creatnew::. *Note _dos_read::.  *Note
  4858. _dos_write::. *Note _dos_close::
  4859.  
  4860. Return Value
  4861. ------------
  4862.  
  4863. Returns 0 if successful or DOS error code on error (and sets ERRNO)
  4864.  
  4865. Example
  4866. -------
  4867.  
  4868.      int handle;
  4869.      
  4870.      if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
  4871.         puts("Creating was successful !");
  4872.  
  4873. 
  4874. File: libc,  Node: _dos_creatnew,  Next: _dos_findfirst,  Prev: _dos_creat,  Up: Alphabetical List
  4875.  
  4876. _dos_creatnew
  4877. =============
  4878.  
  4879. Syntax
  4880. ------
  4881.  
  4882.      #include <dos.h>
  4883.      
  4884.      unsigned int _dos_creatnew(const char *filename, unsigned short attr, int *handle);
  4885.  
  4886. Description
  4887. -----------
  4888.  
  4889. This is a direct connection to the MS-DOS create unique function call
  4890. (%ah = 0x5B). This function creates the given file with the given
  4891. attribute and puts file handle into HANDLE if creating is successful.
  4892. This function will fail if the specified file exists. Meaning of ATTR
  4893. parameter is the following:
  4894.  
  4895. `_A_NORMAL (0x00)'
  4896.      Normal file (no read/write restrictions)
  4897.  
  4898. `_A_RDONLY (0x01)'
  4899.      Read only file
  4900.  
  4901. `_A_HIDDEN (0x02)'
  4902.      Hidden file
  4903.  
  4904. `_A_SYSTEM (0x04)'
  4905.      System file
  4906.  
  4907. `_A_ARCH (0x20)'
  4908.      Archive file
  4909.  
  4910. *Note _dos_open::. *Note _dos_creat::. *Note _dos_read::.  *Note
  4911. _dos_write::. *Note _dos_close::
  4912.  
  4913. Return Value
  4914. ------------
  4915.  
  4916. Returns 0 if successful or DOS error code on error (and sets ERRNO).
  4917.  
  4918. Example
  4919. -------
  4920.  
  4921.      int handle;
  4922.      
  4923.      if ( !_dos_creatnew("FOO.DAT", _A_NORMAL, &handle) )
  4924.         puts("Creating was successful !");
  4925.  
  4926. 
  4927. File: libc,  Node: _dos_findfirst,  Next: _dos_findnext,  Prev: _dos_creatnew,  Up: Alphabetical List
  4928.  
  4929. _dos_findfirst
  4930. ==============
  4931.  
  4932. Syntax
  4933. ------
  4934.  
  4935.      #include <dos.h>
  4936.      
  4937.      unsigned int _dos_findfirst(char *name, unsigned int attr, struct find_t *result);
  4938.  
  4939. Description
  4940. -----------
  4941.  
  4942. This function and the related `_dos_findnext' (*note _dos_findnext::.)
  4943. are used to scan directories for the list of files therein. The NAME is
  4944. a wildcard that specifies the directory and files to search. RESULT is
  4945. a structure to hold the results and state of the search, and ATTR is a
  4946. combination of the following:
  4947.  
  4948. `_A_NORMAL (0x00)'
  4949.      Normal file (no read/write restrictions)
  4950.  
  4951. `_A_RDONLY (0x01)'
  4952.      Read only file
  4953.  
  4954. `_A_HIDDEN (0x02)'
  4955.      Hidden file
  4956.  
  4957. `_A_SYSTEM (0x04)'
  4958.      System file
  4959.  
  4960. `_A_VOLID (0x08)'
  4961.      Volume ID file
  4962.  
  4963. `_A_SUBDIR (0x10)'
  4964.      Subdirectory
  4965.  
  4966. `_A_ARCH (0x20)'
  4967.      Archive file
  4968.  
  4969. *Note _dos_findnext::.
  4970.  
  4971. Return Value
  4972. ------------
  4973.  
  4974. Zero if a match is found, DOS error code if not found (and sets ERRNO).
  4975.  
  4976. Example
  4977. -------
  4978.  
  4979.      struct find_t f;
  4980.      
  4981.      if ( !_dos_findfirst("*.DAT", &result, _A_ARCH | _A_RDONLY) )
  4982.      {
  4983.        do
  4984.        {
  4985.          printf("%-14s %10u %02u:%02u:%02u %02u/%02u/%04u\n",
  4986.                 f.name,
  4987.                 f.size,
  4988.                 (f.wr_time >> 11) & 0x1f,
  4989.                 (f.wr_time >>  5) & 0x3f,
  4990.                 (f.wr_time & 0x1f) * 2,
  4991.                 (f.wr_date >>  5) & 0x0f,
  4992.                 (f.wr_date & 0x1f),
  4993.                 ((f.wr_date >> 9) & 0x7f) + 1980,
  4994.        } while( !_dos_findnext(&f) );
  4995.      }
  4996.  
  4997. 
  4998. File: libc,  Node: _dos_findnext,  Next: _dos_getdate,  Prev: _dos_findfirst,  Up: Alphabetical List
  4999.  
  5000. _dos_findnext
  5001. =============
  5002.  
  5003. Syntax
  5004. ------
  5005.  
  5006.      #include <dos.h>
  5007.      
  5008.      unsigned int _dos_findnext(struct _find_t *result);
  5009.  
  5010. Description
  5011. -----------
  5012.  
  5013. This finds the next file in the search started by `_dos_findfirst'.
  5014.  
  5015. *Note _dos_findfirst::.
  5016.  
  5017. Return Value
  5018. ------------
  5019.  
  5020. Zero if a match is found, DOS error code if not found (and sets ERRNO).
  5021.  
  5022. 
  5023. File: libc,  Node: _dos_getdate,  Next: _dos_getdiskfree,  Prev: _dos_findnext,  Up: Alphabetical List
  5024.  
  5025. _dos_getdate
  5026. ============
  5027.  
  5028. Syntax
  5029. ------
  5030.  
  5031.      #include <dos.h>
  5032.      
  5033.      void _dos_getdate(struct dosdate_t *date);
  5034.  
  5035. Description
  5036. -----------
  5037.  
  5038. This function gets the current date and fills the DATE structure with
  5039. these values.
  5040.  
  5041.      struct dosdate_t {
  5042.        unsigned char  day;       /* 1-31          */
  5043.        unsigned char  month;     /* 1-12          */
  5044.        unsigned short year;      /* 1980-2099     */
  5045.        unsigned char  dayofweek; /* 0-6, 0=Sunday */
  5046.      };
  5047.  
  5048. *Note _dos_setdate::. *Note _dos_gettime::. *Note _dos_settime::.
  5049.  
  5050. Return Value
  5051. ------------
  5052.  
  5053. None.
  5054.  
  5055. Example
  5056. -------
  5057.  
  5058.      struct dosdate_t date;
  5059.      
  5060.      _dos_getdate(&date);
  5061.  
  5062. 
  5063. File: libc,  Node: _dos_getdiskfree,  Next: _dos_getdrive,  Prev: _dos_getdate,  Up: Alphabetical List
  5064.  
  5065. _dos_getdiskfree
  5066. ================
  5067.  
  5068. `_dos_getdiskfree'
  5069. ==================
  5070.  
  5071. Syntax
  5072. ------
  5073.  
  5074.      #include <dos.h>
  5075.      
  5076.      unsigned int _dos_getdiskfree(unsigned int drive, struct diskfree_t *diskspace);
  5077.  
  5078. Description
  5079. -----------
  5080.  
  5081. This function determines the free space on DRIVE drive (0=default,
  5082. 1=A:, 2=B:, etc.) and fills DISKSPACE structure.
  5083.  
  5084. Return Value
  5085. ------------
  5086.  
  5087. Returns with 0 if successful and non-zero on error (sets ERRNO=EINVAL).
  5088.  
  5089. Example
  5090. -------
  5091.  
  5092.      struct diskfree_t df;
  5093.      unsigned long freebytes;
  5094.      
  5095.      if ( !_dos_getdiskfree(0, &df) )
  5096.      {
  5097.        freebytes = (unsigned long)df.avail_clusters *
  5098.                    (unsigned long)df.bytes_per_sector *
  5099.                    (unsigned long)df.sectors_per_cluster;
  5100.        printf("There is %lu free bytes on the current drive.\n", freebytes);
  5101.      }
  5102.      else
  5103.        printf("Unable to get free disk space.\n");
  5104.  
  5105. 
  5106. File: libc,  Node: _dos_getdrive,  Next: _dos_getfileattr,  Prev: _dos_getdiskfree,  Up: Alphabetical List
  5107.  
  5108. _dos_getdrive
  5109. =============
  5110.  
  5111. `_dos_getdrive'
  5112. ===============
  5113.  
  5114. Syntax
  5115. ------
  5116.  
  5117.      #include <dos.h>
  5118.      
  5119.      void _dos_getdrive(unsigned int *p_drive);
  5120.  
  5121. Description
  5122. -----------
  5123.  
  5124. This function determine the current default drive and writes this value
  5125. into P_DRIVE (1=A:, 2=B:, etc.).
  5126.  
  5127. *Note _dos_setdrive::.
  5128.  
  5129. Return Value
  5130. ------------
  5131.  
  5132. None.
  5133.  
  5134. Example
  5135. -------
  5136.  
  5137.      unsigned int drive;
  5138.      
  5139.      _dos_getdrive(&drive);
  5140.      printf("The current drive is %c:.\n", 'A' - 1 + drive);
  5141.  
  5142. 
  5143. File: libc,  Node: _dos_getfileattr,  Next: _dos_getftime,  Prev: _dos_getdrive,  Up: Alphabetical List
  5144.  
  5145. _dos_getfileattr
  5146. ================
  5147.  
  5148. `_dos_getfileattr'
  5149. ==================
  5150.  
  5151. Syntax
  5152. ------
  5153.  
  5154.      #include <dos.h>
  5155.      
  5156.      unsigned int _dos_getfileattr(const char *filename, unsigned int *p_attr);
  5157.  
  5158. Description
  5159. -----------
  5160.  
  5161. This function determines the attributes of given file and fills ATTR
  5162. with it. Use the following constans (in DOS.H) to check this value.
  5163.  
  5164. `_A_NORMAL (0x00)'
  5165.      Normal file (no read/write restrictions)
  5166.  
  5167. `_A_RDONLY (0x01)'
  5168.      Read only file
  5169.  
  5170. `_A_HIDDEN (0x02)'
  5171.      Hidden file
  5172.  
  5173. `_A_SYSTEM (0x04)'
  5174.      System file
  5175.  
  5176. `_A_VOLID (0x08)'
  5177.      Volume ID file
  5178.  
  5179. `_A_SUBDIR (0x10)'
  5180.      Subdirectory
  5181.  
  5182. `_A_ARCH (0x20)'
  5183.      Archive file
  5184.  
  5185. *Note _dos_setfileattr::.
  5186.  
  5187. Return Value
  5188. ------------
  5189.  
  5190. Returns with 0 if successful and DOS error value on error (and sets
  5191. ERRNO=ENOENT).
  5192.  
  5193. Example
  5194. -------
  5195.  
  5196.      unsigned int attr;
  5197.      
  5198.      if ( !_dos_getfileattr("FOO.DAT", &attr) )
  5199.      {
  5200.        puts("FOO.DAT attributes are:");
  5201.        if ( attr & _A_ARCH )   puts("Archive");
  5202.        if ( attr & _A_RDONLY ) puts("Read only");
  5203.        if ( attr & _A_HIDDEN ) puts("Hidden");
  5204.        if ( attr & _A_SYSTEM ) puts("Is it part of DOS ?");
  5205.        if ( attr & _A_VOLID )  puts("Volume ID");
  5206.        if ( attr & _A_SUBDIR ) puts("Directory");
  5207.      }
  5208.      else
  5209.        puts("Unable to get FOO.DAT attributes.");
  5210.  
  5211. 
  5212. File: libc,  Node: _dos_getftime,  Next: _dos_gettime,  Prev: _dos_getfileattr,  Up: Alphabetical List
  5213.  
  5214. _dos_getftime
  5215. =============
  5216.  
  5217. Syntax
  5218. ------
  5219.  
  5220.      #include <dos.h>
  5221.      
  5222.      unsigned int _dos_getftime(int handle, unsigned int *p_date, unsigned *p_time);
  5223.  
  5224. Description
  5225. -----------
  5226.  
  5227. This function gets the date and time of the given file and puts these
  5228. values into P_DATE and P_TIME variable. The meaning of DOS date in the
  5229. P_DATE variable is the following:
  5230.  
  5231.      F   E   D   C   B   A   9   8   7   6   5   4   3   2   1   0  (bits)
  5232.      X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X
  5233.      *-----------------------*   *-----------*   *---------------*
  5234.              year                    month              day
  5235.      
  5236.      year  = 0-119 (relative to 1980)
  5237.      month = 1-12
  5238.      day   = 1-31
  5239.  
  5240. The meaning of DOS time in the P_TIME variable is the following:
  5241.  
  5242.      F   E   D   C   B   A   9   8   7   6   5   4   3   2   1   0
  5243.      X   X   X   X   X   X   X   X   X   X   X   X   X   X   X   X
  5244.      *---------------*   *-------------------*   *---------------*
  5245.            hours              minutes                seconds
  5246.      
  5247.      hours   = 0-23
  5248.      minutes = 0-59
  5249.      seconds = 0-29 in two-second intervals
  5250.  
  5251. *Note _dos_setftime::.
  5252.  
  5253. Return Value
  5254. ------------
  5255.  
  5256. Returns 0 if successful and return DOS error on error (and sets
  5257. ERRNO=EBADF).
  5258.  
  5259. Example
  5260. -------
  5261.  
  5262.      unsigned int handle, date, time;
  5263.      
  5264.      _dos_open("FOO.DAT", O_RDWR, &handle);
  5265.      _dos_gettime(handle, &date, &time);
  5266.      _dos_close(handle);
  5267.      printf("FOO.DAT date and time is: %04u-%02u-%02u %02u:%02u:%02u.\n",
  5268.             /*       year                      month              day    */
  5269.             ((date >> 9) & 0x7F) + 1980U, (date >>  5) & 0x0F, date & 0x1F,
  5270.             /*       hour                minute           second         */
  5271.             (time >> 11) & 0x1F, (time >>  5) & 0x3F, (time & 0x1F) * 2);
  5272.  
  5273. 
  5274. File: libc,  Node: _dos_gettime,  Next: _dos_lock,  Prev: _dos_getftime,  Up: Alphabetical List
  5275.  
  5276. _dos_gettime
  5277. ============
  5278.  
  5279. Syntax
  5280. ------
  5281.  
  5282.      #include <dos.h>
  5283.      
  5284.      void _dos_gettime(struct dostime_t *time);
  5285.  
  5286. Description
  5287. -----------
  5288.  
  5289. This function gets the current time and fills the TIME structure with
  5290. these values.
  5291.  
  5292.      struct dostime_t {
  5293.        unsigned char hour;     /* 0-23 */
  5294.        unsigned char minute;   /* 0-59 */
  5295.        unsigned char second;   /* 0-59 */
  5296.        unsigned char hsecond;  /* 0-99 */
  5297.      };
  5298.  
  5299. *Note _dos_settime::. *Note _dos_getdate::. *Note _dos_setdate::.
  5300.  
  5301. Return Value
  5302. ------------
  5303.  
  5304. None.
  5305.  
  5306. Example
  5307. -------
  5308.  
  5309.      struct dostime_t time;
  5310.      
  5311.      _dos_gettime(&time);
  5312.  
  5313. 
  5314. File: libc,  Node: _dos_lock,  Next: _dos_open,  Prev: _dos_gettime,  Up: Alphabetical List
  5315.  
  5316. _dos_lock
  5317. =========
  5318.  
  5319. Syntax
  5320. ------
  5321.  
  5322.      #include <io.h>
  5323.      
  5324.      _dos_lock(int _fd, long _offset, long _length)
  5325.  
  5326. Description
  5327. -----------
  5328.  
  5329. Adds an advisory lock to the specified region of the file.
  5330.  
  5331. Return Value
  5332. ------------
  5333.  
  5334. Zero if the lock was added, nonzero otherwise.
  5335.  
  5336. 
  5337. File: libc,  Node: _dos_open,  Next: _dos_read,  Prev: _dos_lock,  Up: Alphabetical List
  5338.  
  5339. _dos_open
  5340. =========
  5341.  
  5342. Syntax
  5343. ------
  5344.  
  5345.      #include <fcntl.h>
  5346.      #include <share.h>
  5347.      #include <dos.h>
  5348.      
  5349.      unsigned int _dos_open(const char *filename, unsigned short mode, int *handle);
  5350.  
  5351. Description
  5352. -----------
  5353.  
  5354. This is a direct connection to the MS-DOS open function call (%ah =
  5355. 0x3D).  This function opens the given file with the given mode and puts
  5356. handle of file into HANDLE if openning is successful.  Meaning of MODE
  5357. parameter is the following:
  5358.  
  5359. Access mode bits (in FCNTL.H):
  5360. `O_RDONLY (_O_RDONLY) 0x00'
  5361.      Open for read only
  5362.  
  5363. `O_WRONLY (_O_WRONLY) 0x01'
  5364.      Open for write only
  5365.  
  5366. `O_RDWR (_O_RDWR) 0x02'
  5367.      Open for read and write
  5368.  
  5369. Sharing mode bits (in SHARE.H):
  5370. `SH_COMPAT (_SH_COMPAT) 0x00'
  5371.      Compatibility mode
  5372.  
  5373. `SH_DENYRW (_SH_DENYRW) 0x10'
  5374.      Deny read/write mode
  5375.  
  5376. `SH_DENYWR (_SH_DENYWR) 0x20'
  5377.      Deny write mode
  5378.  
  5379. `SH_DENYRD (_SH_DENYRD) 0x30'
  5380.      Deny read mode
  5381.  
  5382. `SH_DENYNO (_SH_DENYNO) 0x40'
  5383.      Deny none mode
  5384.  
  5385. Inheritance bits (in FCNTL.H):
  5386. `O_NOINHERIT (_O_NOINHERIT) 0x80'
  5387.      File is not inherited by child process
  5388.  
  5389. *Note _dos_creat::. *Note _dos_creatnew::. *Note _dos_read::.  *Note
  5390. _dos_write::. *Note _dos_close::
  5391.  
  5392. Return Value
  5393. ------------
  5394.  
  5395. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  5396. EACCES, EINVAL, EMFILE or ENOENT).
  5397.  
  5398. Example
  5399. -------
  5400.  
  5401.      int handle;
  5402.      
  5403.      if ( !_dos_open("FOO.DAT", O_RDWR, &handle) )
  5404.         puts("Wow, file opening was successful !");
  5405.  
  5406. 
  5407. File: libc,  Node: _dos_read,  Next: _dos_setdate,  Prev: _dos_open,  Up: Alphabetical List
  5408.  
  5409. _dos_read
  5410. =========
  5411.  
  5412. Syntax
  5413. ------
  5414.  
  5415.      #include <dos.h>
  5416.      
  5417.      unsigned int _dos_read(int handle, void *buffer, unsigned int count, unsigned int *result);
  5418.  
  5419. Description
  5420. -----------
  5421.  
  5422. This is a direct connection to the MS-DOS read function call (%ah =
  5423. 0x3F).  No conversion is done on the data; it is read as raw binary
  5424. data. This function reads from HANDLE into BUFFER COUNT bytes.  COUNT
  5425. value may be arbitrary size (for example > 64KB). It puts number of
  5426. bytes read into RESULT if reading is successful.
  5427.  
  5428. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  5429. _dos_write::. *Note _dos_close::
  5430.  
  5431. Return Value
  5432. ------------
  5433.  
  5434. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  5435. EACCES or EBADF)
  5436.  
  5437. Example
  5438. -------
  5439.  
  5440.      int handle;
  5441.      unsigned int result;
  5442.      char *filebuffer;
  5443.      
  5444.      if ( !_dos_open("FOO.DAT", O_RDONLY, &handle) )
  5445.      {
  5446.         puts("FOO.DAT openning was successful.");
  5447.         if ( (filebuffer = malloc(130000)) != NULL )
  5448.         {
  5449.           if ( !_dos_read(handle, buffer, 130000, &result) )
  5450.             printf("%u bytes read from FOO.DAT.\n", result);
  5451.           else
  5452.             puts("Reading error.");
  5453.           ...
  5454.           /* Do something with filebuffer. */
  5455.           ...
  5456.         }
  5457.         _dos_close(handle);
  5458.      }
  5459.  
  5460. 
  5461. File: libc,  Node: _dos_setdate,  Next: _dos_setdrive,  Prev: _dos_read,  Up: Alphabetical List
  5462.  
  5463. _dos_setdate
  5464. ============
  5465.  
  5466. Syntax
  5467. ------
  5468.  
  5469.      #include <dos.h>
  5470.      
  5471.      unsigned int _dos_setdate(struct dosdate_t *date);
  5472.  
  5473. Description
  5474. -----------
  5475.  
  5476. This function sets the current date. The DOSDATE_T structure is as
  5477. follows:
  5478.  
  5479.      struct dosdate_t {
  5480.        unsigned char  day;       /* 1-31          */
  5481.        unsigned char  month;     /* 1-12          */
  5482.        unsigned short year;      /* 1980-2099     */
  5483.        unsigned char  dayofweek; /* 0-6, 0=Sunday */
  5484.      };
  5485.  
  5486. DAYOFWEEK field has no effect at this function call.
  5487.  
  5488. *Note _dos_getdate::. *Note _dos_gettime::. *Note _dos_settime::.
  5489.  
  5490. Return Value
  5491. ------------
  5492.  
  5493. Returns 0 if successful and non-zero on error (and sets ERRNO=EINVAL).
  5494.  
  5495. Example
  5496. -------
  5497.  
  5498.      struct dosdate_t date;
  5499.      
  5500.      date->year  = 1999;
  5501.      date->month = 12;
  5502.      date->day   = 31;
  5503.      if ( !_dos_setdate(&date) )
  5504.        puts("It was a valid date.");
  5505.  
  5506. 
  5507. File: libc,  Node: _dos_setdrive,  Next: _dos_setfileattr,  Prev: _dos_setdate,  Up: Alphabetical List
  5508.  
  5509. _dos_setdrive
  5510. =============
  5511.  
  5512. `_dos_setdrive'
  5513. ===============
  5514.  
  5515. Syntax
  5516. ------
  5517.  
  5518.      #include <dos.h>
  5519.      
  5520.      void _dos_setdrive(unsigned int drive, unsigned int *p_drives);
  5521.  
  5522. Description
  5523. -----------
  5524.  
  5525. This function set the current default drive based on DRIVE (1=A:, 2=B:,
  5526. etc.) and determines the number of available logical drives and fills
  5527. P_DRIVES with it.
  5528.  
  5529. *Note _dos_getdrive::.
  5530.  
  5531. Return Value
  5532. ------------
  5533.  
  5534. None.
  5535.  
  5536. Example
  5537. -------
  5538.  
  5539.      unsigned int available_drives;
  5540.      
  5541.      /* The current drive will be A: */
  5542.      _dos_setdrive(1, &available_drives);
  5543.      printf("Number of available logical drives %u.\n", available_drives);
  5544.  
  5545. 
  5546. File: libc,  Node: _dos_setfileattr,  Next: _dos_setftime,  Prev: _dos_setdrive,  Up: Alphabetical List
  5547.  
  5548. _dos_setfileattr
  5549. ================
  5550.  
  5551. `_dos_setfileattr'
  5552. ==================
  5553.  
  5554. Syntax
  5555. ------
  5556.  
  5557.      #include <dos.h>
  5558.      
  5559.      unsigned int _dos_setfileattr(const char *filename, unsigned int attr);
  5560.  
  5561. Description
  5562. -----------
  5563.  
  5564. This function sets the attributes of given file. Use the following
  5565. constans in DOS.H to create ATTR parameter:
  5566.  
  5567. `_A_NORMAL (0x00)'
  5568.      Normal file (no read/write restrictions)
  5569.  
  5570. `_A_RDONLY (0x01)'
  5571.      Read only file
  5572.  
  5573. `_A_HIDDEN (0x02)'
  5574.      Hidden file
  5575.  
  5576. `_A_SYSTEM (0x04)'
  5577.      System file
  5578.  
  5579. `_A_VOLID (0x08)'
  5580.      Volume ID file
  5581.  
  5582. `_A_SUBDIR (0x10)'
  5583.      Subdirectory
  5584.  
  5585. `_A_ARCH (0x20)'
  5586.      Archive file
  5587.  
  5588. *Note _dos_getfileattr::.
  5589.  
  5590. Return Value
  5591. ------------
  5592.  
  5593. Returns with 0 if successful and DOS error value on error (and sets
  5594. ERRNO to ENOENT or EACCES).
  5595.  
  5596. Example
  5597. -------
  5598.  
  5599.      if ( !_dos_setfileattr("FOO.DAT", _A_RDONLY | _A_HIDDEN) )
  5600.         puts("FOO.DAT is hidden now.");
  5601.  
  5602. 
  5603. File: libc,  Node: _dos_setftime,  Next: _dos_settime,  Prev: _dos_setfileattr,  Up: Alphabetical List
  5604.  
  5605. _dos_setftime
  5606. =============
  5607.  
  5608. Syntax
  5609. ------
  5610.  
  5611.      #include <dos.h>
  5612.      
  5613.      unsigned int _dos_setftime(int handle, unsigned int date, unsigned time);
  5614.  
  5615. Description
  5616. -----------
  5617.  
  5618. This function sets the date and time of the given file. The meaning of
  5619. DOS date in the DATE variable is the following:
  5620.  
  5621.      F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits)
  5622.      x x x x x x x x x x x x x x x x
  5623.      *-----------* *-----* *-------*
  5624.          year       month     day
  5625.      
  5626.      year  = 0-119 (relative to 1980)
  5627.      month = 1-12
  5628.      day   = 1-31
  5629.  
  5630. The meaning of DOS time in the TIME variable is the following:
  5631.  
  5632.      F E D C B A 9 8 7 6 5 4 3 2 1 0 (bits)
  5633.      x x x x x x x x x x x x x x x x
  5634.      *-------* *---------* *-------*
  5635.        hours     minutes    seconds
  5636.      
  5637.      hours   = 0-23
  5638.      minutes = 0-59
  5639.      seconds = 0-29 in two-second intervals
  5640.  
  5641. *Note _dos_getftime::.
  5642.  
  5643. Return Value
  5644. ------------
  5645.  
  5646. Returns 0 if successful and return DOS error on error (and sets
  5647. ERRNO=EBADF).
  5648.  
  5649. Example
  5650. -------
  5651.  
  5652.      struct dosdate_t d;
  5653.      struct dostime_t t;
  5654.      unsigned int handle, date, time;
  5655.      
  5656.      _dos_open("FOO.DAT", O_RDWR, &handle);
  5657.      _dos_getdate(&d);
  5658.      _dos_gettime(&t);
  5659.      date = ((d.year - 1980) << 9) | (d.month << 5) | d.day;
  5660.      time = (t.hour << 11) | (t.minute << 5) | (t.second / 2);
  5661.      _dos_settime(handle, date, time);
  5662.      _dos_close(handle);
  5663.  
  5664. 
  5665. File: libc,  Node: _dos_settime,  Next: _dos_unlock,  Prev: _dos_setftime,  Up: Alphabetical List
  5666.  
  5667. _dos_settime
  5668. ============
  5669.  
  5670. Syntax
  5671. ------
  5672.  
  5673.      #include <dos.h>
  5674.      
  5675.      void _dos_settime(struct dostime_t *time);
  5676.  
  5677. Description
  5678. -----------
  5679.  
  5680. This function sets the current time. The TIME structure is as follows:
  5681.  
  5682.      struct dostime_t {
  5683.        unsigned char hour;     /* 0-23 */
  5684.        unsigned char minute;   /* 0-59 */
  5685.        unsigned char second;   /* 0-59 */
  5686.        unsigned char hsecond;  /* 0-99 */
  5687.      };
  5688.  
  5689. *Note _dos_gettime::. *Note _dos_getdate::. *Note _dos_setdate::.
  5690.  
  5691. Return Value
  5692. ------------
  5693.  
  5694. Returns 0 if successful and non-zero on error (and sets ERRNO=EINVAL).
  5695.  
  5696. Example
  5697. -------
  5698.  
  5699.      struct dostime_t time;
  5700.      
  5701.      time->hour    = 23;
  5702.      time->minute  = 59;
  5703.      time->second  = 59;
  5704.      time->hsecond = 99;
  5705.      if ( !_dos_settime(&time) )
  5706.        puts("It was a valid time.");
  5707.  
  5708. 
  5709. File: libc,  Node: _dos_unlock,  Next: _dos_write,  Prev: _dos_settime,  Up: Alphabetical List
  5710.  
  5711. _dos_unlock
  5712. ===========
  5713.  
  5714. Syntax
  5715. ------
  5716.  
  5717.      #include <io.h>
  5718.      
  5719.      _dos_unlock(int _fd, long _offset, long _length)
  5720.  
  5721. Description
  5722. -----------
  5723.  
  5724. Removes an advisory lock to the specified region of the file.
  5725.  
  5726. Return Value
  5727. ------------
  5728.  
  5729. Zero if the lock was removed, nonzero otherwise.
  5730.  
  5731. 
  5732. File: libc,  Node: _dos_write,  Next: _doscan,  Prev: _dos_unlock,  Up: Alphabetical List
  5733.  
  5734. _dos_write
  5735. ==========
  5736.  
  5737. Syntax
  5738. ------
  5739.  
  5740.      #include <dos.h>
  5741.      
  5742.      unsigned int _dos_write(int handle, const void *buffer, unsigned int count,
  5743.                              unsigned int *result);
  5744.  
  5745. Description
  5746. -----------
  5747.  
  5748. This is a direct connection to the MS-DOS write function call (%ah =
  5749. 0x40).  No conversion is done on the data; it is written as raw binary
  5750. data. This function writes COUNT bytes from BUFFER to HANDLE.  COUNT
  5751. value may be arbitrary size (e.g. > 64KB). It puts number of bytes
  5752. written into RESULT if writing is successful.
  5753.  
  5754. *Note _dos_open::. *Note _dos_creat::. *Note _dos_creatnew::.  *Note
  5755. _dos_read::. *Note _dos_close::
  5756.  
  5757. Return Value
  5758. ------------
  5759.  
  5760. Returns 0 if successful or DOS error code on error (and sets ERRNO to
  5761. EACCES or EBADF)
  5762.  
  5763. Example
  5764. -------
  5765.  
  5766.      int handle;
  5767.      unsigned int result;
  5768.      char *filebuffer;
  5769.      
  5770.      if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
  5771.      {
  5772.         puts("FOO.DAT creating was successful.");
  5773.         if ( (filebuffer = malloc(130000)) != NULL )
  5774.         {
  5775.           ...
  5776.           /* Put something into filebuffer. */
  5777.           ...
  5778.           if ( !_dos_write(handle, buffer, 130000, &result) )
  5779.             printf("%u bytes written into FOO.DAT.", result);
  5780.           else
  5781.             puts("Writing error.");
  5782.         }
  5783.         _dos_close(handle);
  5784.      }
  5785.  
  5786. 
  5787. File: libc,  Node: _doscan,  Next: dosexterr,  Prev: _dos_write,  Up: Alphabetical List
  5788.  
  5789. _doscan
  5790. =======
  5791.  
  5792. Syntax
  5793. ------
  5794.  
  5795.      #include <stdio.h>
  5796.      
  5797.      int _doscan(FILE *file, const char *format, void **ptrs_to_args);
  5798.  
  5799. Description
  5800. -----------
  5801.  
  5802. This is an internal function that is used by all the `scanf' style
  5803. functions, which simply pass their format, arguments, and stream to this
  5804. function.
  5805.  
  5806. *Note scanf:: for a discussion of the allowed formats and arguments.
  5807.  
  5808. Return Value
  5809. ------------
  5810.  
  5811. The number of characters successfully scanned is returned, or -1 on
  5812. error.
  5813.  
  5814. Example
  5815. -------
  5816.  
  5817.      int x, y;
  5818.      int *args[2];
  5819.      args[0] = &x;
  5820.      args[1] = &y;
  5821.      _doscan(stdin, "%d %d", args);
  5822.  
  5823. 
  5824. File: libc,  Node: dosexterr,  Next: dosmemget,  Prev: _doscan,  Up: Alphabetical List
  5825.  
  5826. dosexterr
  5827. =========
  5828.  
  5829. Syntax
  5830. ------
  5831.  
  5832.      #include <dos.h>
  5833.      
  5834.      int dosexterr(struct DOSERROR *p_error);
  5835.  
  5836. Description
  5837. -----------
  5838.  
  5839. This function reads extended error information from DOS and fills
  5840. P_ERROR structure.
  5841.  
  5842.      struct _DOSERROR {
  5843.        int  exterror;
  5844.        char class;
  5845.        char action;
  5846.        char locus;
  5847.      };
  5848.  
  5849. Values for extended error code (EXTERROR field):
  5850.      00h (0)   no error
  5851.      01h (1)   function number invalid
  5852.      02h (2)   file not found
  5853.      03h (3)   path not found
  5854.      04h (4)   too many open files (no handles available)
  5855.      05h (5)   access denied
  5856.      06h (6)   invalid handle
  5857.      07h (7)   memory control block destroyed
  5858.      08h (8)   insufficient memory
  5859.      09h (9)   memory block address invalid
  5860.      0Ah (10)  environment invalid (usually >32K in length)
  5861.      0Bh (11)  format invalid
  5862.      0Ch (12)  access code invalid
  5863.      0Dh (13)  data invalid
  5864.      0Eh (14)  reserved
  5865.      0Fh (15)  invalid drive
  5866.      10h (16)  attempted to remove current directory
  5867.      11h (17)  not same device
  5868.      12h (18)  no more files
  5869.      13h (19)  disk write-protected
  5870.      14h (20)  unknown unit
  5871.      15h (21)  drive not ready
  5872.      16h (22)  unknown command
  5873.      17h (23)  data error (CRC)
  5874.      18h (24)  bad request structure length
  5875.      19h (25)  seek error
  5876.      1Ah (26)  unknown media type (non-DOS disk)
  5877.      1Bh (27)  sector not found
  5878.      1Ch (28)  printer out of paper
  5879.      1Dh (29)  write fault
  5880.      1Eh (30)  read fault
  5881.      1Fh (31)  general failure
  5882.      20h (32)  sharing violation
  5883.      21h (33)  lock violation
  5884.      22h (34)  disk change invalid (ES:DI -> media ID structure)(see below)
  5885.      23h (35)  FCB unavailable
  5886.      24h (36)  sharing buffer overflow
  5887.      25h (37)  (DOS 4+) code page mismatch
  5888.      26h (38)  (DOS 4+) cannot complete file operation (out of input)
  5889.      27h (39)  (DOS 4+) insufficient disk space
  5890.      28h-31h   reserved
  5891.      32h (50)  network request not supported
  5892.      33h (51)  remote computer not listening
  5893.      34h (52)  duplicate name on network
  5894.      35h (53)  network name not found
  5895.      36h (54)  network busy
  5896.      37h (55)  network device no longer exists
  5897.      38h (56)  network BIOS command limit exceeded
  5898.      39h (57)  network adapter hardware error
  5899.      3Ah (58)  incorrect response from network
  5900.      3Bh (59)  unexpected network error
  5901.      3Ch (60)  incompatible remote adapter
  5902.      3Dh (61)  print queue full
  5903.      3Eh (62)  queue not full
  5904.      3Fh (63)  not enough space to print file
  5905.      40h (64)  network name was deleted
  5906.      41h (65)  network: Access denied
  5907.      42h (66)  network device type incorrect
  5908.      43h (67)  network name not found
  5909.      44h (68)  network name limit exceeded
  5910.      45h (69)  network BIOS session limit exceeded
  5911.      46h (70)  temporarily paused
  5912.      47h (71)  network request not accepted
  5913.      48h (72)  network print/disk redirection paused
  5914.      49h (73)  network software not installed
  5915.                (LANtastic) invalid network version
  5916.      4Ah (74)  unexpected adapter close
  5917.                (LANtastic) account expired
  5918.      4Bh (75)  (LANtastic) password expired
  5919.      4Ch (76)  (LANtastic) login attempt invalid at this time
  5920.      4Dh (77)  (LANtastic v3+) disk limit exceeded on network node
  5921.      4Eh (78)  (LANtastic v3+) not logged in to network node
  5922.      4Fh (79)  reserved
  5923.      50h (80)  file exists
  5924.      51h (81)  reserved
  5925.      52h (82)  cannot make directory
  5926.      53h (83)  fail on INT 24h
  5927.      54h (84)  (DOS 3.3+) too many redirections
  5928.      55h (85)  (DOS 3.3+) duplicate redirection
  5929.      56h (86)  (DOS 3.3+) invalid password
  5930.      57h (87)  (DOS 3.3+) invalid parameter
  5931.      58h (88)  (DOS 3.3+) network write fault
  5932.      59h (89)  (DOS 4+) function not supported on network
  5933.      5Ah (90)  (DOS 4+) required system component not installed
  5934.      64h (100) (MSCDEX) unknown error
  5935.      65h (101) (MSCDEX) not ready
  5936.      66h (102) (MSCDEX) EMS memory no longer valid
  5937.      67h (103) (MSCDEX) not High Sierra or ISO-9660 format
  5938.      68h (104) (MSCDEX) door open
  5939.  
  5940. Values for error class (CLASS field):
  5941.      01h  out of resource (storage space or I/O channels)
  5942.      02h  temporary situation (file or record lock)
  5943.      03h  authorization (denied access)
  5944.      04h  internal (system software bug)
  5945.      05h  hardware failure
  5946.      06h  system failure (configuration file missing or incorrect)
  5947.      07h  application program error
  5948.      08h  not found
  5949.      09h  bad format
  5950.      0Ah  locked
  5951.      0Bh  media error
  5952.      0Ch  already exists
  5953.      0Dh  unknown
  5954.  
  5955. Values for suggested action (ACTION field):
  5956.      01h  retry
  5957.      02h  delayed retry
  5958.      03h  prompt user to reenter input
  5959.      04h  abort after cleanup
  5960.      05h  immediate abort
  5961.      06h  ignore
  5962.      07h  retry after user intervention
  5963.  
  5964. Values for error locus (LOCUS field):
  5965.      01h  unknown or not appropriate
  5966.      02h  block device (disk error)
  5967.      03h  network related
  5968.      04h  serial device (timeout)
  5969.      05h  memory related
  5970.  
  5971. Return Value
  5972. ------------
  5973.  
  5974. Returns with the extended error code.
  5975.  
  5976. Example
  5977. -------
  5978.  
  5979.      #include <stdio.h>
  5980.      #include <dos.h>
  5981.      
  5982.      void main(void)
  5983.      {
  5984.        FILE *fp;
  5985.        struct _DOSERROR de;
  5986.      
  5987.        fp = fopen("EXAMPLE.DAT","r");
  5988.        if ( fp == NULL )
  5989.        {
  5990.          puts("Unable to open file for reading.");
  5991.          _dosexterr(&de);
  5992.          printf("Extended DOS error information:\n");
  5993.          printf("Extended error: %i\n",de.exterror);
  5994.          printf("Class:          %x\n",de.class);
  5995.          printf("Action:         %x\n",de.action);
  5996.          printf("Error Locus:    %x\n",de.locus);
  5997.        }
  5998.      }
  5999.  
  6000. 
  6001. File: libc,  Node: dosmemget,  Next: dosmemgetb,  Prev: dosexterr,  Up: Alphabetical List
  6002.  
  6003. dosmemget
  6004. =========
  6005.  
  6006. Syntax
  6007. ------
  6008.  
  6009.      #include <sys/movedata.h>
  6010.      
  6011.      void dosmemget(int offset, int length, void *buffer);
  6012.  
  6013. Description
  6014. -----------
  6015.  
  6016. This function transfers data from MS-DOS's conventional memory space to
  6017. the program's virtual address space.  The OFFSET is a physical address,
  6018. which can be computed from a real-mode segment/offset pair as follows:
  6019.  
  6020.      offset = segment * 16 + offset;
  6021.  
  6022. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  6023. to somewhere in your virtual address space (such as memory obtained
  6024. from `malloc') where the data will go.
  6025.  
  6026. Return Value
  6027. ------------
  6028.  
  6029. None.
  6030.  
  6031. Example
  6032. -------
  6033.  
  6034.      unsigned short shift_state;
  6035.      dosmemget(0x417, 2, &shift_state);
  6036.      if (shift_state & 0x0004)
  6037.        /* Ctrl key pressed */;
  6038.  
  6039. 
  6040. File: libc,  Node: dosmemgetb,  Next: dosmemgetl,  Prev: dosmemget,  Up: Alphabetical List
  6041.  
  6042. dosmemgetb
  6043. ==========
  6044.  
  6045. Syntax
  6046. ------
  6047.  
  6048.      #include <sys/movedata.h>
  6049.      
  6050.      void _dosmemgetb(unsigned long offset, size_t xfers, void *buffer);
  6051.  
  6052. Description
  6053. -----------
  6054.  
  6055. This function transfers data from MS-DOS's conventional memory space to
  6056. the program's virtual address space, using only byte transfers.  The
  6057. OFFSET is a physical address, which can be computed from a real-mode
  6058. segment/offset pair as follows:
  6059.  
  6060.      offset = segment * 16 + offset;
  6061.  
  6062. The XFERS is the number of bytes to transfer, and BUFFER is a pointer
  6063. to somewhere in your virtual address space (such as memory obtained
  6064. from `malloc') where the data will go.
  6065.  
  6066. Return Value
  6067. ------------
  6068.  
  6069. None.
  6070.  
  6071. Example
  6072. -------
  6073.  
  6074.      unsigned short shift_state;
  6075.      dosmemgetb(0x417, 2, &shift_state);
  6076.      if (shift_state & 0x0004)
  6077.        /* Ctrl key pressed */;
  6078.  
  6079. 
  6080. File: libc,  Node: dosmemgetl,  Next: dosmemgetw,  Prev: dosmemgetb,  Up: Alphabetical List
  6081.  
  6082. dosmemgetl
  6083. ==========
  6084.  
  6085. Syntax
  6086. ------
  6087.  
  6088.      #include <sys/movedata.h>
  6089.      
  6090.      void _dosmemgetl(unsigned long offset, size_t xfers, void *buffer);
  6091.  
  6092. Description
  6093. -----------
  6094.  
  6095. This function transfers data from MS-DOS's conventional memory space to
  6096. the program's virtual address space, using only long-word (32-bit)
  6097. transfers.  The OFFSET is a physical address, which can be computed
  6098. from a real-mode segment/offset pair as follows:
  6099.  
  6100.      offset = segment * 16 + offset;
  6101.  
  6102. The COUNT is the number of long-words to transfer, and BUFFER is a
  6103. pointer to somewhere in your virtual address space (such as memory
  6104. obtained from `malloc') where the data will go.
  6105.  
  6106. Return Value
  6107. ------------
  6108.  
  6109. None.
  6110.  
  6111. Example
  6112. -------
  6113.  
  6114.      unsigned long shift_state;
  6115.      dosmemgetl(0x417, 1, &shift_state);
  6116.      if (shift_state & 0x0004)
  6117.        /* Ctrl key pressed */;
  6118.  
  6119. 
  6120. File: libc,  Node: dosmemgetw,  Next: dosmemput,  Prev: dosmemgetl,  Up: Alphabetical List
  6121.  
  6122. dosmemgetw
  6123. ==========
  6124.  
  6125. Syntax
  6126. ------
  6127.  
  6128.      #include <sys/movedata.h>
  6129.      
  6130.      void _dosmemgetw(unsigned long offset, size_t xfers, void *buffer);
  6131.  
  6132. Description
  6133. -----------
  6134.  
  6135. This function transfers data from MS-DOS's conventional memory space to
  6136. the program's virtual address space, using only short-word (16-bit)
  6137. transfers.  The OFFSET is a physical address, which can be computed
  6138. from a real-mode segment/offset pair as follows:
  6139.  
  6140.      offset = segment * 16 + offset;
  6141.  
  6142. The XFERS is the number of words to transfer, and BUFFER is a pointer
  6143. to somewhere in your virtual address space (such as memory obtained
  6144. from `malloc') where the data will go.
  6145.  
  6146. Return Value
  6147. ------------
  6148.  
  6149. None.
  6150.  
  6151. Example
  6152. -------
  6153.  
  6154.      unsigned short shift_state;
  6155.      dosmemgetw(0x417, 1, &shift_state);
  6156.      if (shift_state & 0x0004)
  6157.        /* Ctrl key pressed */;
  6158.  
  6159. 
  6160. File: libc,  Node: dosmemput,  Next: dosmemputb,  Prev: dosmemgetw,  Up: Alphabetical List
  6161.  
  6162. dosmemput
  6163. =========
  6164.  
  6165. Syntax
  6166. ------
  6167.  
  6168.      #include <sys/movedata.h>
  6169.      
  6170.      void dosmemput(const void *buffer, int length, int offset);
  6171.  
  6172. Description
  6173. -----------
  6174.  
  6175. This function transfers data from the program's virtual address space to
  6176. MS-DOS's conventional memory space.  The OFFSET is a physical address,
  6177. which can be computed from a real-mode segment/offset pair as follows:
  6178.  
  6179.      offset = segment * 16 + offset;
  6180.  
  6181. The LENGTH is the number of bytes to transfer, and BUFFER is a pointer
  6182. to somewhere in your virtual address space (such as memory obtained
  6183. from `malloc') where the data will come from.
  6184.  
  6185. Return Value
  6186. ------------
  6187.  
  6188. None.
  6189.  
  6190. Example
  6191. -------
  6192.  
  6193.      unsigned short save_screen[25][80];
  6194.      dosmemput(save_screen, 0xb8000, 80*2*25);
  6195.  
  6196. 
  6197. File: libc,  Node: dosmemputb,  Next: dosmemputl,  Prev: dosmemput,  Up: Alphabetical List
  6198.  
  6199. dosmemputb
  6200. ==========
  6201.  
  6202. Syntax
  6203. ------
  6204.  
  6205.      #include <sys/movedata.h>
  6206.      
  6207.      void _dosmemputb(const void *buffer, size_t xfers, unsigned long offset);
  6208.  
  6209. Description
  6210. -----------
  6211.  
  6212. This function transfers data from the program's virtual address space
  6213. to MS-DOS's conventional memory space, using only byte (8-bit)
  6214. transfers.  The OFFSET is a physical address, which can be computed
  6215. from a real-mode segment/offset pair as follows:
  6216.  
  6217.      offset = segment * 16 + offset;
  6218.  
  6219. The XFERS is the number of bytes to transfer, and BUFFER is a pointer
  6220. to somewhere in your virtual address space (such as memory obtained
  6221. from `malloc') where the data will come from.
  6222.  
  6223. Return Value
  6224. ------------
  6225.  
  6226. None.
  6227.  
  6228. Example
  6229. -------
  6230.  
  6231.      unsigned short save_screen[25][80];
  6232.      dosmemputb(save_screen, 0xb8000, 80*2*25);
  6233.  
  6234. 
  6235. File: libc,  Node: dosmemputl,  Next: dosmemputw,  Prev: dosmemputb,  Up: Alphabetical List
  6236.  
  6237. dosmemputl
  6238. ==========
  6239.  
  6240. Syntax
  6241. ------
  6242.  
  6243.      #include <sys/movedata.h>
  6244.      
  6245.      void _dosmemputl(const void *buffer, size_t xfers unsigned long offset);
  6246.  
  6247. Description
  6248. -----------
  6249.  
  6250. This function transfers data from the program's virtual address space
  6251. to MS-DOS's conventional memory space, using only long-word (32-bit)
  6252. transfers.  The OFFSET is a physical address, which can be computed
  6253. from a real-mode segment/offset pair as follows:
  6254.  
  6255.      offset = segment * 16 + offset;
  6256.  
  6257. The XFERS is the number of long-words to transfer, and BUFFER is a
  6258. pointer to somewhere in your virtual address space (such as memory
  6259. obtained from `malloc') where the data will come from.
  6260.  
  6261. Return Value
  6262. ------------
  6263.  
  6264. None.
  6265.  
  6266. Example
  6267. -------
  6268.  
  6269.      unsigned short save_screen[25][80];
  6270.      dosmemputl(save_screen, 0xb8000, 40*25);
  6271.  
  6272. 
  6273. File: libc,  Node: dosmemputw,  Next: DPMI Overview,  Prev: dosmemputl,  Up: Alphabetical List
  6274.  
  6275. dosmemputw
  6276. ==========
  6277.  
  6278. Syntax
  6279. ------
  6280.  
  6281.      #include <sys/movedata.h>
  6282.      
  6283.      void _dosmemputw(const void *buffer, size_t xfers, unsigned long offset);
  6284.  
  6285. Description
  6286. -----------
  6287.  
  6288. This function transfers data from the program's virtual address space
  6289. to MS-DOS's conventional memory space, using only short-word (16-bit)
  6290. transfers.  The OFFSET is a physical address, which can be computed
  6291. from a real-mode segment/offset pair as follows:
  6292.  
  6293.      offset = segment * 16 + offset;
  6294.  
  6295. The XFERS is the number of short-words to transfer, and BUFFER is a
  6296. pointer to somewhere in your virtual address space (such as memory
  6297. obtained from `malloc') where the data will come from.
  6298.  
  6299. Return Value
  6300. ------------
  6301.  
  6302. None.
  6303.  
  6304. Example
  6305. -------
  6306.  
  6307.      unsigned short save_screen[25][80];
  6308.      dosmemputw(save_screen, 0xb8000, 80*25);
  6309.  
  6310. 
  6311. File: libc,  Node: DPMI Overview,  Next: DPMI Specification,  Prev: dosmemputw,  Up: Alphabetical List
  6312.  
  6313. DPMI Overview
  6314. =============
  6315.  
  6316.      extern unsigned short __dpmi_error;
  6317.  
  6318. For most functions, the error returned from the DPMI server is stored
  6319. in this variable.
  6320.  
  6321.      typedef struct {
  6322.        unsigned short offset16;
  6323.        unsigned short segment;
  6324.      } __dpmi_raddr;
  6325.  
  6326. This structure is used to hold a real-mode address, which consists of a
  6327. segment:offset pair.
  6328.  
  6329.      typedef struct {
  6330.        unsigned long  offset32;
  6331.        unsigned short selector;
  6332.      } __dpmi_paddr;
  6333.  
  6334. This structure is used to hold a protected-mode address, which consists
  6335. of a selector:offset pair.
  6336.  
  6337.      typedef struct {
  6338.        unsigned long handle;            /* 0, 2 */
  6339.        unsigned long size;     /* or count */    /* 4, 6 */
  6340.        unsigned long address;        /* 8, 10 */
  6341.      } __dpmi_meminfo;
  6342.  
  6343. This structure is used by many functions that need to refer to blocks
  6344. of 32-bit memory.  The `size' field doubles as a count for those
  6345. operations that want a count of something, or return a count.
  6346.  
  6347.      typedef union {
  6348.        struct {
  6349.          unsigned long edi;
  6350.          unsigned long esi;
  6351.          unsigned long ebp;
  6352.          unsigned long res;
  6353.          unsigned long ebx;
  6354.          unsigned long edx;
  6355.          unsigned long ecx;
  6356.          unsigned long eax;
  6357.        } d;
  6358.        struct {
  6359.          unsigned short di, di_hi;
  6360.          unsigned short si, si_hi;
  6361.          unsigned short bp, bp_hi;
  6362.          unsigned short res, res_hi;
  6363.          unsigned short bx, bx_hi;
  6364.          unsigned short dx, dx_hi;
  6365.          unsigned short cx, cx_hi;
  6366.          unsigned short ax, ax_hi;
  6367.          unsigned short flags;
  6368.          unsigned short es;
  6369.          unsigned short ds;
  6370.          unsigned short fs;
  6371.          unsigned short gs;
  6372.          unsigned short ip;
  6373.          unsigned short cs;
  6374.          unsigned short sp;
  6375.          unsigned short ss;
  6376.        } x;
  6377.        struct {
  6378.          unsigned char edi[4];
  6379.          unsigned char esi[4];
  6380.          unsigned char ebp[4];
  6381.          unsigned char res[4];
  6382.          unsigned char bl, bh, ebx_b2, ebx_b3;
  6383.          unsigned char dl, dh, edx_b2, edx_b3;
  6384.          unsigned char cl, ch, ecx_b2, ecx_b3;
  6385.          unsigned char al, ah, eax_b2, eax_b3;
  6386.        } h;
  6387.      } __dpmi_regs;
  6388.  
  6389. This structure is used by functions that pass register information,
  6390. such as simulating real-mode calls.
  6391.  
  6392.      typedef struct {
  6393.        unsigned char  major;
  6394.        unsigned char  minor;
  6395.        unsigned short flags;
  6396.        unsigned char  cpu;
  6397.        unsigned char  master_pic;
  6398.        unsigned char  slave_pic;
  6399.      } __dpmi_version_ret;
  6400.  
  6401. This structure is used to return version information to the program.
  6402.  
  6403.      typedef struct {
  6404.        unsigned long largest_available_free_block_in_bytes;
  6405.        unsigned long maximum_unlocked_page_allocation_in_pages;
  6406.        unsigned long maximum_locked_page_allocation_in_pages;
  6407.        unsigned long linear_address_space_size_in_pages;
  6408.        unsigned long total_number_of_unlocked_pages;
  6409.        unsigned long total_number_of_free_pages;
  6410.        unsigned long total_number_of_physical_pages;
  6411.        unsigned long free_linear_address_space_in_pages;
  6412.        unsigned long size_of_paging_file_partition_in_pages;
  6413.        unsigned long reserved[3];
  6414.      } __dpmi_free_mem_info;
  6415.  
  6416. This structure is used to return information about the state of virtual
  6417. memory in the system.
  6418.  
  6419.      typedef struct {
  6420.        unsigned long total_allocated_bytes_of_physical_memory_host;
  6421.        unsigned long total_allocated_bytes_of_virtual_memory_host;
  6422.        unsigned long total_available_bytes_of_virtual_memory_host;
  6423.        unsigned long total_allocated_bytes_of_virtual_memory_vcpu;
  6424.        unsigned long total_available_bytes_of_virtual_memory_vcpu;
  6425.        unsigned long total_allocated_bytes_of_virtual_memory_client;
  6426.        unsigned long total_available_bytes_of_virtual_memory_client;
  6427.        unsigned long total_locked_bytes_of_memory_client;
  6428.        unsigned long max_locked_bytes_of_memory_client;
  6429.        unsigned long highest_linear_address_available_to_client;
  6430.        unsigned long size_in_bytes_of_largest_free_memory_block;
  6431.        unsigned long size_of_minimum_allocation_unit_in_bytes;
  6432.        unsigned long size_of_allocation_alignmentunit_in_bytes;
  6433.        unsigned long reserved[19];
  6434.      } __dpmi_memory_info;
  6435.  
  6436. This is also used to return memory information, but by a different
  6437. function.
  6438.  
  6439.      typedef struct {
  6440.        unsigned long data16[2];
  6441.        unsigned long code16[2];
  6442.        unsigned short ip;
  6443.        unsigned short reserved;
  6444.        unsigned long data32[2];
  6445.        unsigned long code32[2];
  6446.        unsigned long eip;
  6447.      } __dpmi_callback_info;
  6448.  
  6449. This structure is used to install TSR programs.
  6450.  
  6451.      typedef struct {
  6452.        unsigned long size_requested;
  6453.        unsigned long size;
  6454.        unsigned long handle;
  6455.        unsigned long address;
  6456.        unsigned long name_offset;
  6457.        unsigned short name_selector;
  6458.        unsigned short reserved1;
  6459.        unsigned long reserved2;
  6460.      } __dpmi_shminfo;
  6461.  
  6462. This structure is used to manipulate shared memory regions.
  6463.  
  6464. 
  6465. File: libc,  Node: DPMI Specification,  Next: __dpmi_allocate_dos_memory,  Prev: DPMI Overview,  Up: Alphabetical List
  6466.  
  6467. DPMI Specification
  6468. ==================
  6469.  
  6470. To obtain the DPMI specification, Contact Intel and order document
  6471. number 240977-001.  Also, try ftp.qdeck.com:/pub/memory/dpmi* and
  6472. http://www.delorie.com/djgpp/doc/dpmi/.
  6473.  
  6474. 
  6475. File: libc,  Node: __dpmi_allocate_dos_memory,  Next: __dpmi_allocate_ldt_descriptors,  Prev: DPMI Specification,  Up: Alphabetical List
  6476.  
  6477. __dpmi_allocate_dos_memory
  6478. ==========================
  6479.  
  6480. Syntax
  6481. ------
  6482.  
  6483.      #include <dpmi.h>
  6484.      
  6485.      int __dpmi_allocate_dos_memory(int _paragraphs, int *_ret_selector_or_max);
  6486.  
  6487. Description
  6488. -----------
  6489.  
  6490. Please refer to *Note DPMI Specification:: for details on DPMI function
  6491. call operation.  Also see *Note DPMI Overview:: for general information.
  6492.  
  6493. DPMI function AX = 0x0100
  6494.  
  6495. This function allocates DOS memory.  You pass it the number of
  6496. paragraphs ((bytes+15)>>4) to allocate.  If it succeeds, it returns a
  6497. segment (dos-style) and fills in _RET_SELECTOR_OR_MAX with a selector
  6498. (protected-mode) that you can use to reference the same memory.  Note
  6499. that it's the selector you use to free the block, not the segment.
  6500.  
  6501. Return Value
  6502. ------------
  6503.  
  6504. -1 on error, else the segment [0000..FFFF].
  6505.  
  6506. 
  6507. File: libc,  Node: __dpmi_allocate_ldt_descriptors,  Next: __dpmi_allocate_linear_memory,  Prev: __dpmi_allocate_dos_memory,  Up: Alphabetical List
  6508.  
  6509. __dpmi_allocate_ldt_descriptors
  6510. ===============================
  6511.  
  6512. Syntax
  6513. ------
  6514.  
  6515.      #include <dpmi.h>
  6516.      
  6517.      int __dpmi_allocate_ldt_descriptors(int count);
  6518.  
  6519. Description
  6520. -----------
  6521.  
  6522. Please refer to *Note DPMI Specification:: for details on DPMI function
  6523. call operation.  Also see *Note DPMI Overview:: for general information.
  6524.  
  6525. DPMI function AX = 0x0000
  6526.  
  6527. Allocates COUNT descriptors.
  6528.  
  6529. Return Value
  6530. ------------
  6531.  
  6532. -1 on error, else the first descriptor.  Use *Note
  6533. __dpmi_get_selector_increment_value:: to figure out the remaining
  6534. selectors.
  6535.  
  6536. Example
  6537. -------
  6538.  
  6539.      short sel = __dpmi_allocate_ldt_descriptors(1);
  6540.  
  6541. 
  6542. File: libc,  Node: __dpmi_allocate_linear_memory,  Next: __dpmi_allocate_memory,  Prev: __dpmi_allocate_ldt_descriptors,  Up: Alphabetical List
  6543.  
  6544. __dpmi_allocate_linear_memory
  6545. =============================
  6546.  
  6547. Syntax
  6548. ------
  6549.  
  6550.      #include <dpmi.h>
  6551.      
  6552.      int __dpmi_allocate_linear_memory
  6553.  
  6554. Description
  6555. -----------
  6556.  
  6557. Please refer to *Note DPMI Specification:: for details on DPMI function
  6558. call operation.  Also see *Note DPMI Overview:: for general information.
  6559.  
  6560. DPMI function AX = 0x0504 (DPMI 1.0 only)
  6561.  
  6562. This allocates a block of page-aligned linear address space.  Pass a
  6563. desired address (or zero for any) and a size.  _COMMIT is 1 for
  6564. committed pages, else they are uncommitted.  It returns a handle and
  6565. the actual address.
  6566.  
  6567. Return Value
  6568. ------------
  6569.  
  6570. -1 on error, else zero.
  6571.  
  6572. 
  6573. File: libc,  Node: __dpmi_allocate_memory,  Next: __dpmi_allocate_real_mode_callback,  Prev: __dpmi_allocate_linear_memory,  Up: Alphabetical List
  6574.  
  6575. __dpmi_allocate_memory
  6576. ======================
  6577.  
  6578. Syntax
  6579. ------
  6580.  
  6581.      #include <dpmi.h>
  6582.      
  6583.      int __dpmi_allocate_memory(__dpmi_meminfo *_info);
  6584.  
  6585. Description
  6586. -----------
  6587.  
  6588. Please refer to *Note DPMI Specification:: for details on DPMI function
  6589. call operation.  Also see *Note DPMI Overview:: for general information.
  6590.  
  6591. DPMI function AX = 0x0501
  6592.  
  6593. This allocates virtual memory.  Fill in size, returns handle and
  6594. address.
  6595.  
  6596. Return Value
  6597. ------------
  6598.  
  6599. -1 on error, else zero.
  6600.  
  6601. 
  6602. File: libc,  Node: __dpmi_allocate_real_mode_callback,  Next: __dpmi_allocate_shared_memory,  Prev: __dpmi_allocate_memory,  Up: Alphabetical List
  6603.  
  6604. __dpmi_allocate_real_mode_callback
  6605. ==================================
  6606.  
  6607. Syntax
  6608. ------
  6609.  
  6610.      #include <dpmi.h>
  6611.      
  6612.      int __dpmi_allocate_real_mode_callback(void (*_handler)(void), __dpmi_regs *_regs, __dpmi_raddr *_ret);
  6613.  
  6614. Description
  6615. -----------
  6616.  
  6617. Please refer to *Note DPMI Specification:: for details on DPMI function
  6618. call operation.  Also see *Note DPMI Overview:: for general information.
  6619.  
  6620. DPMI function AX = 0x0303
  6621.  
  6622. This function gives you a real-mode address to pass to TSRs that gets
  6623. reflected to your protected-mode handler.  You pass it a register block
  6624. to use; it gets filled in with the real-mode registers when your
  6625. handler is called, and the registers are set from it when the handler
  6626. returns.
  6627.  
  6628. Return Value
  6629. ------------
  6630.  
  6631. -1 on error, else zero.
  6632.  
  6633. 
  6634. File: libc,  Node: __dpmi_allocate_shared_memory,  Next: __dpmi_allocate_specific_ldt_descriptor,  Prev: __dpmi_allocate_real_mode_callback,  Up: Alphabetical List
  6635.  
  6636. __dpmi_allocate_shared_memory
  6637. =============================
  6638.  
  6639. Syntax
  6640. ------
  6641.  
  6642.      #include <dpmi.h>
  6643.      
  6644.      int __dpmi_allocate_shared_memory(__dpmi_shminfo *_info);
  6645.  
  6646. Description
  6647. -----------
  6648.  
  6649. Please refer to *Note DPMI Specification:: for details on DPMI function
  6650. call operation.  Also see *Note DPMI Overview:: for general information.
  6651.  
  6652. DPMI function AX = 0x0d00 (DPMI 1.0 only)
  6653.  
  6654. See the spec.
  6655.  
  6656. Return Value
  6657. ------------
  6658.  
  6659. -1 on error, else zero.
  6660.  
  6661. 
  6662. File: libc,  Node: __dpmi_allocate_specific_ldt_descriptor,  Next: __dpmi_clear_debug_watchpoint,  Prev: __dpmi_allocate_shared_memory,  Up: Alphabetical List
  6663.  
  6664. __dpmi_allocate_specific_ldt_descriptor
  6665. =======================================
  6666.  
  6667. Syntax
  6668. ------
  6669.  
  6670.      #include <dpmi.h>
  6671.      
  6672.      int __dpmi_allocate_specific_ldt_descriptor(int _selector);
  6673.  
  6674. Description
  6675. -----------
  6676.  
  6677. Please refer to *Note DPMI Specification:: for details on DPMI function
  6678. call operation.  Also see *Note DPMI Overview:: for general information.
  6679.  
  6680. DPMI function AX = 0x000d
  6681.  
  6682. This allocates the specific selector given.
  6683.  
  6684. Return Value
  6685. ------------
  6686.  
  6687. -1 on error, else zero.
  6688.  
  6689. 
  6690. File: libc,  Node: __dpmi_clear_debug_watchpoint,  Next: __dpmi_create_alias_descriptor,  Prev: __dpmi_allocate_specific_ldt_descriptor,  Up: Alphabetical List
  6691.  
  6692. __dpmi_clear_debug_watchpoint
  6693. =============================
  6694.  
  6695. Syntax
  6696. ------
  6697.  
  6698.      #include <dpmi.h>
  6699.      
  6700.      int __dpmi_clear_debug_watchpoint(unsigned long _handle);
  6701.  
  6702. Description
  6703. -----------
  6704.  
  6705. Please refer to *Note DPMI Specification:: for details on DPMI function
  6706. call operation.  Also see *Note DPMI Overview:: for general information.
  6707.  
  6708. DPMI function AX = 0x0b01
  6709.  
  6710. Clear a debug watchpoint.
  6711.  
  6712. Return Value
  6713. ------------
  6714.  
  6715. -1 on error, else zero.
  6716.  
  6717. 
  6718. File: libc,  Node: __dpmi_create_alias_descriptor,  Next: __dpmi_discard_page_contents,  Prev: __dpmi_clear_debug_watchpoint,  Up: Alphabetical List
  6719.  
  6720. __dpmi_create_alias_descriptor
  6721. ==============================
  6722.  
  6723. Syntax
  6724. ------
  6725.  
  6726.      #include <dpmi.h>
  6727.      
  6728.      int __dpmi_create_alias_descriptor(int _selector);
  6729.  
  6730. Description
  6731. -----------
  6732.  
  6733. Please refer to *Note DPMI Specification:: for details on DPMI function
  6734. call operation.  Also see *Note DPMI Overview:: for general information.
  6735.  
  6736. DPMI function AX = 0x000a
  6737.  
  6738. Create a new selector with the same parameters as the given one.
  6739.  
  6740. Return Value
  6741. ------------
  6742.  
  6743. -1 on error, else the new selector.
  6744.  
  6745. 
  6746. File: libc,  Node: __dpmi_discard_page_contents,  Next: __dpmi_free_dos_memory,  Prev: __dpmi_create_alias_descriptor,  Up: Alphabetical List
  6747.  
  6748. __dpmi_discard_page_contents
  6749. ============================
  6750.  
  6751. Syntax
  6752. ------
  6753.  
  6754.      #include <dpmi.h>
  6755.      
  6756.      int __dpmi_discard_page_contents(__dpmi_meminfo *_info);
  6757.  
  6758. Description
  6759. -----------
  6760.  
  6761. Please refer to *Note DPMI Specification:: for details on DPMI function
  6762. call operation.  Also see *Note DPMI Overview:: for general information.
  6763.  
  6764. DPMI function AX = 0x0703
  6765.  
  6766. Advises the server that the given pages are no longer needed and may be
  6767. reclaimed.  Fill in address and size (in bytes).
  6768.  
  6769. Return Value
  6770. ------------
  6771.  
  6772. -1 on error, else zero.
  6773.  
  6774. 
  6775. File: libc,  Node: __dpmi_free_dos_memory,  Next: __dpmi_free_ldt_descriptor,  Prev: __dpmi_discard_page_contents,  Up: Alphabetical List
  6776.  
  6777. __dpmi_free_dos_memory
  6778. ======================
  6779.  
  6780. Syntax
  6781. ------
  6782.  
  6783.      #include <dpmi.h>
  6784.      
  6785.      int __dpmi_free_dos_memory(int _selector);
  6786.  
  6787. Description
  6788. -----------
  6789.  
  6790. Please refer to *Note DPMI Specification:: for details on DPMI function
  6791. call operation.  Also see *Note DPMI Overview:: for general information.
  6792.  
  6793. DPMI function AX = 0x0101
  6794.  
  6795. This function frees the dos memory allocated by *Note
  6796. __dpmi_allocate_dos_memory::.  Remember to pass the selector and not
  6797. the segment.
  6798.  
  6799. Return Value
  6800. ------------
  6801.  
  6802. -1 on error, else zero.
  6803.  
  6804. 
  6805. File: libc,  Node: __dpmi_free_ldt_descriptor,  Next: __dpmi_free_memory,  Prev: __dpmi_free_dos_memory,  Up: Alphabetical List
  6806.  
  6807. __dpmi_free_ldt_descriptor
  6808. ==========================
  6809.  
  6810. Syntax
  6811. ------
  6812.  
  6813.      #include <dpmi.h>
  6814.      
  6815.      int __dpmi_free_ldt_descriptor(int descriptor);
  6816.  
  6817. Description
  6818. -----------
  6819.  
  6820. Please refer to *Note DPMI Specification:: for details on DPMI function
  6821. call operation.  Also see *Note DPMI Overview:: for general information.
  6822.  
  6823. DPMI function AX = 0x0001
  6824.  
  6825. This function frees a single descriptor, even if it was allocated as
  6826. one of many.
  6827.  
  6828. Return Value
  6829. ------------
  6830.  
  6831. -1 on error, else zero.
  6832.  
  6833. Example
  6834. -------
  6835.  
  6836.      __dpmi_free_ldt_descriptor(sel);
  6837.  
  6838. 
  6839. File: libc,  Node: __dpmi_free_memory,  Next: __dpmi_free_physical_address_mapping,  Prev: __dpmi_free_ldt_descriptor,  Up: Alphabetical List
  6840.  
  6841. __dpmi_free_memory
  6842. ==================
  6843.  
  6844. Syntax
  6845. ------
  6846.  
  6847.      #include <dpmi.h>
  6848.      
  6849.      int __dpmi_free_memory(unsigned long _handle);
  6850.  
  6851. Description
  6852. -----------
  6853.  
  6854. Please refer to *Note DPMI Specification:: for details on DPMI function
  6855. call operation.  Also see *Note DPMI Overview:: for general information.
  6856.  
  6857. DPMI function AX = 0x0502
  6858.  
  6859. This frees a block of virtual memory.
  6860.  
  6861. Return Value
  6862. ------------
  6863.  
  6864. -1 on error, else zero.
  6865.  
  6866. 
  6867. File: libc,  Node: __dpmi_free_physical_address_mapping,  Next: __dpmi_free_real_mode_callback,  Prev: __dpmi_free_memory,  Up: Alphabetical List
  6868.  
  6869. __dpmi_free_physical_address_mapping
  6870. ====================================
  6871.  
  6872. Syntax
  6873. ------
  6874.  
  6875.      #include <dpmi.h>
  6876.      
  6877.      int __dpmi_free_physical_address_mapping(__dpmi_meminfo *_info);
  6878.  
  6879. Description
  6880. -----------
  6881.  
  6882. Please refer to *Note DPMI Specification:: for details on DPMI function
  6883. call operation.  Also see *Note DPMI Overview:: for general information.
  6884.  
  6885. DPMI function AX = 0x0801
  6886.  
  6887. This function unmaps a physical device mapped with *Note
  6888. __dpmi_physical_address_mapping::.  Fill in the linear address.
  6889.  
  6890. Return Value
  6891. ------------
  6892.  
  6893. -1 on error, else zero.
  6894.  
  6895. 
  6896. File: libc,  Node: __dpmi_free_real_mode_callback,  Next: __dpmi_free_serialization_on_shared_memory,  Prev: __dpmi_free_physical_address_mapping,  Up: Alphabetical List
  6897.  
  6898. __dpmi_free_real_mode_callback
  6899. ==============================
  6900.  
  6901. Syntax
  6902. ------
  6903.  
  6904.      #include <dpmi.h>
  6905.      
  6906.      int __dpmi_free_real_mode_callback(__dpmi_raddr *_addr);
  6907.  
  6908. Description
  6909. -----------
  6910.  
  6911. Please refer to *Note DPMI Specification:: for details on DPMI function
  6912. call operation.  Also see *Note DPMI Overview:: for general information.
  6913.  
  6914. DPMI function AX = 0x0303
  6915.  
  6916. This function frees the real-mode callback address.
  6917.  
  6918. Return Value
  6919. ------------
  6920.  
  6921. -1 on error, else zero.
  6922.  
  6923. 
  6924. File: libc,  Node: __dpmi_free_serialization_on_shared_memory,  Next: __dpmi_free_shared_memory,  Prev: __dpmi_free_real_mode_callback,  Up: Alphabetical List
  6925.  
  6926. __dpmi_free_serialization_on_shared_memory
  6927. ==========================================
  6928.  
  6929. Syntax
  6930. ------
  6931.  
  6932.      #include <dpmi.h>
  6933.      
  6934.      int __dpmi_free_serialization_on_shared_memory(unsigned long _handle, int _flags);
  6935.  
  6936. Description
  6937. -----------
  6938.  
  6939. Please refer to *Note DPMI Specification:: for details on DPMI function
  6940. call operation.  Also see *Note DPMI Overview:: for general information.
  6941.  
  6942. DPMI function AX = 0x0d03 (DPMI 1.0 only)
  6943.  
  6944. See the spec.
  6945.  
  6946. Return Value
  6947. ------------
  6948.  
  6949. -1 on error, else zero.
  6950.  
  6951. 
  6952. File: libc,  Node: __dpmi_free_shared_memory,  Next: __dpmi_get_and_disable_virtual_interrupt_state,  Prev: __dpmi_free_serialization_on_shared_memory,  Up: Alphabetical List
  6953.  
  6954. __dpmi_free_shared_memory
  6955. =========================
  6956.  
  6957. Syntax
  6958. ------
  6959.  
  6960.      #include <dpmi.h>
  6961.      
  6962.      int __dpmi_free_shared_memory(unsigned long _handle);
  6963.  
  6964. Description
  6965. -----------
  6966.  
  6967. Please refer to *Note DPMI Specification:: for details on DPMI function
  6968. call operation.  Also see *Note DPMI Overview:: for general information.
  6969.  
  6970. DPMI function AX = 0x0d01 (DPMI 1.0 only)
  6971.  
  6972. See the spec.
  6973.  
  6974. Return Value
  6975. ------------
  6976.  
  6977. -1 on error, else zero.
  6978.  
  6979. 
  6980. File: libc,  Node: __dpmi_get_and_disable_virtual_interrupt_state,  Next: __dpmi_get_and_enable_virtual_interrupt_state,  Prev: __dpmi_free_shared_memory,  Up: Alphabetical List
  6981.  
  6982. __dpmi_get_and_disable_virtual_interrupt_state
  6983. ==============================================
  6984.  
  6985. Syntax
  6986. ------
  6987.  
  6988.      #include <dpmi.h>
  6989.      
  6990.      int __dpmi_get_and_disable_virtual_interrupt_state
  6991.  
  6992. Description
  6993. -----------
  6994.  
  6995. Please refer to *Note DPMI Specification:: for details on DPMI function
  6996. call operation.  Also see *Note DPMI Overview:: for general information.
  6997.  
  6998. DPMI function AX = 0x0900
  6999.  
  7000. This function disables interrupts, and returns the previous setting.
  7001.  
  7002. Return Value
  7003. ------------
  7004.  
  7005. The previous setting.
  7006.  
  7007. 
  7008. File: libc,  Node: __dpmi_get_and_enable_virtual_interrupt_state,  Next: __dpmi_get_and_set_virtual_interrupt_state,  Prev: __dpmi_get_and_disable_virtual_interrupt_state,  Up: Alphabetical List
  7009.  
  7010. __dpmi_get_and_enable_virtual_interrupt_state
  7011. =============================================
  7012.  
  7013. Syntax
  7014. ------
  7015.  
  7016.      #include <dpmi.h>
  7017.      
  7018.      int __dpmi_get_and_enable_virtual_interrupt_state(void);
  7019.  
  7020. Description
  7021. -----------
  7022.  
  7023. Please refer to *Note DPMI Specification:: for details on DPMI function
  7024. call operation.  Also see *Note DPMI Overview:: for general information.
  7025.  
  7026. DPMI function AX = 0x0901
  7027.  
  7028. This function enables interrupts, and returns the previous setting.
  7029.  
  7030. Return Value
  7031. ------------
  7032.  
  7033. The previous setting.
  7034.  
  7035. 
  7036. File: libc,  Node: __dpmi_get_and_set_virtual_interrupt_state,  Next: __dpmi_get_capabilities,  Prev: __dpmi_get_and_enable_virtual_interrupt_state,  Up: Alphabetical List
  7037.  
  7038. __dpmi_get_and_set_virtual_interrupt_state
  7039. ==========================================
  7040.  
  7041. Syntax
  7042. ------
  7043.  
  7044.      #include <dpmi.h>
  7045.      
  7046.      int __dpmi_get_and_set_virtual_interrupt_state(int _old_state);
  7047.  
  7048. Description
  7049. -----------
  7050.  
  7051. Please refer to *Note DPMI Specification:: for details on DPMI function
  7052. call operation.  Also see *Note DPMI Overview:: for general information.
  7053.  
  7054. DPMI function AH = 0x09
  7055.  
  7056. This function restores the interrupt state from a previous call to
  7057. *Note __dpmi_get_and_disable_virtual_interrupt_state:: or *Note
  7058. __dpmi_get_and_enable_virtual_interrupt_state::.
  7059.  
  7060. Return Value
  7061. ------------
  7062.  
  7063. The previous setting.
  7064.  
  7065. 
  7066. File: libc,  Node: __dpmi_get_capabilities,  Next: __dpmi_get_coprocessor_status,  Prev: __dpmi_get_and_set_virtual_interrupt_state,  Up: Alphabetical List
  7067.  
  7068. __dpmi_get_capabilities
  7069. =======================
  7070.  
  7071. Syntax
  7072. ------
  7073.  
  7074.      #include <dpmi.h>
  7075.      
  7076.      int __dpmi_get_capabilities(int *_flags, char *vendor_info);
  7077.  
  7078. Description
  7079. -----------
  7080.  
  7081. Please refer to *Note DPMI Specification:: for details on DPMI function
  7082. call operation.  Also see *Note DPMI Overview:: for general information.
  7083.  
  7084. DPMI function AX = 0x0401 (DPMI 1.0 only)
  7085.  
  7086. Gets the capabilities of the server.  The flags are as follows:
  7087.  
  7088.      ---- ---X = 1="page accessed/dirty" supported
  7089.      ---- --X- = 1="exceptions restartble" supported
  7090.      ---- -X-- = 1="device mapping" supported
  7091.      ---- X--- = 1="map conventional memory" supported
  7092.      ---X ---- = 1="demand zero-fill" supported
  7093.      --X- ---- = 1="write-protect client" supported
  7094.      -X-- ---- = 1="write-protect host" supported
  7095.  
  7096. The vendor info is a 128-byte buffer:
  7097.  
  7098.      [0] host major number
  7099.      [1] host minor number
  7100.      [2..127] vendor name
  7101.  
  7102. Return Value
  7103. ------------
  7104.  
  7105. !-1 on error, else zero.
  7106.  
  7107. 
  7108. File: libc,  Node: __dpmi_get_coprocessor_status,  Next: __dpmi_get_descriptor,  Prev: __dpmi_get_capabilities,  Up: Alphabetical List
  7109.  
  7110. __dpmi_get_coprocessor_status
  7111. =============================
  7112.  
  7113. Syntax
  7114. ------
  7115.  
  7116.      #include <dpmi.h>
  7117.      
  7118.      int __dpmi_get_coprocessor_status(void);
  7119.  
  7120. Description
  7121. -----------
  7122.  
  7123. Please refer to *Note DPMI Specification:: for details on DPMI function
  7124. call operation.  Also see *Note DPMI Overview:: for general information.
  7125.  
  7126. DPMI function AX = 0x0e00 (DPMI 1.0 only)
  7127.  
  7128. Return Value
  7129. ------------
  7130.  
  7131. -1 on error, else returns the processor status flags
  7132.  
  7133. 
  7134. File: libc,  Node: __dpmi_get_descriptor,  Next: __dpmi_get_descriptor_access_rights,  Prev: __dpmi_get_coprocessor_status,  Up: Alphabetical List
  7135.  
  7136. __dpmi_get_descriptor
  7137. =====================
  7138.  
  7139. Syntax
  7140. ------
  7141.  
  7142.      #include <dpmi.h>
  7143.      
  7144.      int __dpmi_get_descriptor(int _selector, void *_buffer);
  7145.  
  7146. Description
  7147. -----------
  7148.  
  7149. Please refer to *Note DPMI Specification:: for details on DPMI function
  7150. call operation.  Also see *Note DPMI Overview:: for general information.
  7151.  
  7152. DPMI function AX = 0x000b
  7153.  
  7154. This function fills a 8-byte buffer with the parameters of the
  7155. descriptor.  The data has the following format:
  7156.  
  7157.      [0] XXXX XXXX = segment limit [7:0]
  7158.      [1] XXXX XXXX = segment limit [15:8]
  7159.      [2] XXXX XXXX = base address [7:0]
  7160.      [3] XXXX XXXX = base address [15:8]
  7161.      [4] XXXX XXXX = base address [23:16]
  7162.      [5] ---- XXXX = type
  7163.      [5] ---X ---- = 0=system, 1=application
  7164.      [5] -XX- ---- = priviledge level
  7165.      [5] X--- ---- = 0=absent, 1=present
  7166.      [6] ---- XXXX = segment limit [19:16]
  7167.      [6] ---X ---- = available for user
  7168.      [6] --0- ---- = must be zero
  7169.      [6] -X-- ---- = 0=16-bit 1=32-bit (cs only)
  7170.      [6] X--- ---- = 0=byte-granular (small) 1=page-granular (big)
  7171.      [7] XXXX XXXX = base address [31:24]
  7172.  
  7173. Return Value
  7174. ------------
  7175.  
  7176. -1 on error, else zero.
  7177.  
  7178. 
  7179. File: libc,  Node: __dpmi_get_descriptor_access_rights,  Next: __dpmi_get_extended_exception_handler_vector_pm,  Prev: __dpmi_get_descriptor,  Up: Alphabetical List
  7180.  
  7181. __dpmi_get_descriptor_access_rights
  7182. ===================================
  7183.  
  7184. Syntax
  7185. ------
  7186.  
  7187.      #include <dpmi.h>
  7188.      
  7189.      int __dpmi_get_descriptor_access_rights(int _selector);
  7190.  
  7191. Description
  7192. -----------
  7193.  
  7194. Please refer to *Note DPMI Specification:: for details on DPMI function
  7195. call operation.  Also see *Note DPMI Overview:: for general information.
  7196.  
  7197. This function returns the access rights byte from the `lar' opcode.
  7198.  
  7199. Return Value
  7200. ------------
  7201.  
  7202. The access byte.  See an Intel programming manual for the list of
  7203. access information.
  7204.  
  7205. 
  7206. File: libc,  Node: __dpmi_get_extended_exception_handler_vector_pm,  Next: __dpmi_get_extended_exception_handler_vector_rm,  Prev: __dpmi_get_descriptor_access_rights,  Up: Alphabetical List
  7207.  
  7208. __dpmi_get_extended_exception_handler_vector_pm
  7209. ===============================================
  7210.  
  7211. Syntax
  7212. ------
  7213.  
  7214.      #include <dpmi.h>
  7215.      
  7216.      int __dpmi_get_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);
  7217.  
  7218. Description
  7219. -----------
  7220.  
  7221. Please refer to *Note DPMI Specification:: for details on DPMI function
  7222. call operation.  Also see *Note DPMI Overview:: for general information.
  7223.  
  7224. DPMI function AX = 0x0210 (DPMI 1.0 only)
  7225.  
  7226. This gets the function that handles protected mode exceptions.
  7227.  
  7228. Return Value
  7229. ------------
  7230.  
  7231. -1 on error, else zero.
  7232.  
  7233. 
  7234. File: libc,  Node: __dpmi_get_extended_exception_handler_vector_rm,  Next: __dpmi_get_free_memory_information,  Prev: __dpmi_get_extended_exception_handler_vector_pm,  Up: Alphabetical List
  7235.  
  7236. __dpmi_get_extended_exception_handler_vector_rm
  7237. ===============================================
  7238.  
  7239. Syntax
  7240. ------
  7241.  
  7242.      #include <dpmi.h>
  7243.      
  7244.      int __dpmi_get_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);
  7245.  
  7246. Description
  7247. -----------
  7248.  
  7249. Please refer to *Note DPMI Specification:: for details on DPMI function
  7250. call operation.  Also see *Note DPMI Overview:: for general information.
  7251.  
  7252. DPMI function AX = 0x0211 (DPMI 1.0 only)
  7253.  
  7254. This function gets the handler for real-mode exceptions.
  7255.  
  7256. Return Value
  7257. ------------
  7258.  
  7259. -1 on error, else zero.
  7260.  
  7261. 
  7262. File: libc,  Node: __dpmi_get_free_memory_information,  Next: __dpmi_get_memory_block_size_and_base,  Prev: __dpmi_get_extended_exception_handler_vector_rm,  Up: Alphabetical List
  7263.  
  7264. __dpmi_get_free_memory_information
  7265. ==================================
  7266.  
  7267. Syntax
  7268. ------
  7269.  
  7270.      #include <dpmi.h>
  7271.      
  7272.      int __dpmi_get_free_memory_information(__dpmi_free_mem_info *_info);
  7273.  
  7274. Description
  7275. -----------
  7276.  
  7277. Please refer to *Note DPMI Specification:: for details on DPMI function
  7278. call operation.  Also see *Note DPMI Overview:: for general information.
  7279.  
  7280. DPMI function AX = 0x0500
  7281.  
  7282. This function returns information about available memory.  Unsupported
  7283. fields will have -1 (0xfffffff) in them.
  7284.  
  7285. Return Value
  7286. ------------
  7287.  
  7288. Zero.  This always works.
  7289.  
  7290. 
  7291. File: libc,  Node: __dpmi_get_memory_block_size_and_base,  Next: __dpmi_get_memory_information,  Prev: __dpmi_get_free_memory_information,  Up: Alphabetical List
  7292.  
  7293. __dpmi_get_memory_block_size_and_base
  7294. =====================================
  7295.  
  7296. Syntax
  7297. ------
  7298.  
  7299.      #include <dpmi.h>
  7300.      
  7301.      int __dpmi_get_memory_block_size_and_base(__dpmi_meminfo *_info);
  7302.  
  7303. Description
  7304. -----------
  7305.  
  7306. Please refer to *Note DPMI Specification:: for details on DPMI function
  7307. call operation.  Also see *Note DPMI Overview:: for general information.
  7308.  
  7309. DPMI function AX = 0x050a (DPMI 1.0 only)
  7310.  
  7311. Pass the handle.  It fills in the address and size.
  7312.  
  7313. Return Value
  7314. ------------
  7315.  
  7316. -1 on error, else zero.
  7317.  
  7318. 
  7319. File: libc,  Node: __dpmi_get_memory_information,  Next: __dpmi_get_multiple_descriptors,  Prev: __dpmi_get_memory_block_size_and_base,  Up: Alphabetical List
  7320.  
  7321. __dpmi_get_memory_information
  7322. =============================
  7323.  
  7324. Syntax
  7325. ------
  7326.  
  7327.      #include <dpmi.h>
  7328.      
  7329.      int __dpmi_get_memory_information(__dpmi_memory_info *_buffer);
  7330.  
  7331. Description
  7332. -----------
  7333.  
  7334. Please refer to *Note DPMI Specification:: for details on DPMI function
  7335. call operation.  Also see *Note DPMI Overview:: for general information.
  7336.  
  7337. DPMI function AX = 0x050b (DPMI 1.0 only)
  7338.  
  7339. This function returns virtual memory information.
  7340.  
  7341. Return Value
  7342. ------------
  7343.  
  7344. -1 on error, else zero.
  7345.  
  7346. 
  7347. File: libc,  Node: __dpmi_get_multiple_descriptors,  Next: __dpmi_get_page_attributes,  Prev: __dpmi_get_memory_information,  Up: Alphabetical List
  7348.  
  7349. __dpmi_get_multiple_descriptors
  7350. ===============================
  7351.  
  7352. Syntax
  7353. ------
  7354.  
  7355.      #include <dpmi.h>
  7356.      
  7357.      int __dpmi_get_multiple_descriptors(int _count, void *_buffer);
  7358.  
  7359. Description
  7360. -----------
  7361.  
  7362. Please refer to *Note DPMI Specification:: for details on DPMI function
  7363. call operation.  Also see *Note DPMI Overview:: for general information.
  7364.  
  7365. DPMI function AX = 0x000e (DPMI 1.0 only)
  7366.  
  7367. This function gets a list of selectors' parameters.  The buffer must be
  7368. prefilled with selector values, and will contain the parameters on
  7369. return:
  7370.  
  7371.      [0x00:2] selector #1 (pass)
  7372.      [0x02:8] parameters #1 (returned)
  7373.      [0x0a:2] selector #2 (pass)
  7374.      [0x0c:8] parameters #2 (returned)
  7375.      ...
  7376.  
  7377. Return Value
  7378. ------------
  7379.  
  7380. Returns _count if successful, the negative of # descriptors copied if
  7381. failure.
  7382.  
  7383. 
  7384. File: libc,  Node: __dpmi_get_page_attributes,  Next: __dpmi_get_page_size,  Prev: __dpmi_get_multiple_descriptors,  Up: Alphabetical List
  7385.  
  7386. __dpmi_get_page_attributes
  7387. ==========================
  7388.  
  7389. Syntax
  7390. ------
  7391.  
  7392.      #include <dpmi.h>
  7393.      
  7394.      int __dpmi_get_page_attributes(__dpmi_meminfo *_info, short *_buffer);
  7395.  
  7396. Description
  7397. -----------
  7398.  
  7399. Please refer to *Note DPMI Specification:: for details on DPMI function
  7400. call operation.  Also see *Note DPMI Overview:: for general information.
  7401.  
  7402. DPMI function AX = 0x0506 (DPMI 1.0 only)
  7403.  
  7404. Pass the handle, offset of first page (relative to start of block) in
  7405. .address, and number of pages in .count.  Buffer gets filled in with
  7406. the attributes (see spec).
  7407.  
  7408. Return Value
  7409. ------------
  7410.  
  7411. -1 on error, else zero.
  7412.  
  7413. 
  7414. File: libc,  Node: __dpmi_get_page_size,  Next: __dpmi_get_processor_exception_handler_vector,  Prev: __dpmi_get_page_attributes,  Up: Alphabetical List
  7415.  
  7416. __dpmi_get_page_size
  7417. ====================
  7418.  
  7419. Syntax
  7420. ------
  7421.  
  7422.      #include <dpmi.h>
  7423.      
  7424.      int __dpmi_get_page_size(unsigned long *_size);
  7425.  
  7426. Description
  7427. -----------
  7428.  
  7429. Please refer to *Note DPMI Specification:: for details on DPMI function
  7430. call operation.  Also see *Note DPMI Overview:: for general information.
  7431.  
  7432. DPMI function AX = 0x0604
  7433.  
  7434. Fills in the page size.
  7435.  
  7436. Return Value
  7437. ------------
  7438.  
  7439. -1 on error (16-bit host), else zero.
  7440.  
  7441. 
  7442. File: libc,  Node: __dpmi_get_processor_exception_handler_vector,  Next: __dpmi_get_protected_mode_interrupt_vector,  Prev: __dpmi_get_page_size,  Up: Alphabetical List
  7443.  
  7444. __dpmi_get_processor_exception_handler_vector
  7445. =============================================
  7446.  
  7447. Syntax
  7448. ------
  7449.  
  7450.      #include <dpmi.h>
  7451.      
  7452.      int __dpmi_get_processor_exception_handler_vector
  7453.  
  7454. Description
  7455. -----------
  7456.  
  7457. Please refer to *Note DPMI Specification:: for details on DPMI function
  7458. call operation.  Also see *Note DPMI Overview:: for general information.
  7459.  
  7460. DPMI function AX = 0x0202
  7461.  
  7462. This function gets the current protected-mode exception handler (not
  7463. interrupts).  It will return a selector:offset pair.
  7464.  
  7465. Return Value
  7466. ------------
  7467.  
  7468. -1 on error (invalid vector), else zero.
  7469.  
  7470. 
  7471. File: libc,  Node: __dpmi_get_protected_mode_interrupt_vector,  Next: __dpmi_get_raw_mode_switch_addr,  Prev: __dpmi_get_processor_exception_handler_vector,  Up: Alphabetical List
  7472.  
  7473. __dpmi_get_protected_mode_interrupt_vector
  7474. ==========================================
  7475.  
  7476. Syntax
  7477. ------
  7478.  
  7479.      #include <dpmi.h>
  7480.      
  7481.      int __dpmi_get_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);
  7482.  
  7483. Description
  7484. -----------
  7485.  
  7486. Please refer to *Note DPMI Specification:: for details on DPMI function
  7487. call operation.  Also see *Note DPMI Overview:: for general information.
  7488.  
  7489. DPMI function AX = 0x0204
  7490.  
  7491. This function gets the address of the current protected mode interrupt
  7492. (not exception) handler.  It returns a selector:offset pair.
  7493.  
  7494. Return Value
  7495. ------------
  7496.  
  7497. Zero.  This always works.
  7498.  
  7499. 
  7500. File: libc,  Node: __dpmi_get_raw_mode_switch_addr,  Next: __dpmi_get_real_mode_interrupt_vector,  Prev: __dpmi_get_protected_mode_interrupt_vector,  Up: Alphabetical List
  7501.  
  7502. __dpmi_get_raw_mode_switch_addr
  7503. ===============================
  7504.  
  7505. Syntax
  7506. ------
  7507.  
  7508.      #include <dpmi.h>
  7509.      
  7510.      int __dpmi_get_raw_mode_switch_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);
  7511.  
  7512. Description
  7513. -----------
  7514.  
  7515. Please refer to *Note DPMI Specification:: for details on DPMI function
  7516. call operation.  Also see *Note DPMI Overview:: for general information.
  7517.  
  7518. DPMI function AX = 0x0306
  7519.  
  7520. Read the spec for more info.
  7521.  
  7522. Return Value
  7523. ------------
  7524.  
  7525. Zero.  This always works.
  7526.  
  7527. 
  7528. File: libc,  Node: __dpmi_get_real_mode_interrupt_vector,  Next: __dpmi_get_segment_base_address,  Prev: __dpmi_get_raw_mode_switch_addr,  Up: Alphabetical List
  7529.  
  7530. __dpmi_get_real_mode_interrupt_vector
  7531. =====================================
  7532.  
  7533. Syntax
  7534. ------
  7535.  
  7536.      #include <dpmi.h>
  7537.      
  7538.      int __dpmi_get_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);
  7539.  
  7540. Description
  7541. -----------
  7542.  
  7543. Please refer to *Note DPMI Specification:: for details on DPMI function
  7544. call operation.  Also see *Note DPMI Overview:: for general information.
  7545.  
  7546. DPMI function AX = 0x0200
  7547.  
  7548. This function stores the real-mode interrupt vector address in
  7549. _ADDRESS. This is the same as the DOS get vector call, and returns a
  7550. real-mode segment:offset pair.
  7551.  
  7552. Bits [31:8] in the vector number are silently ignored.
  7553.  
  7554. Return Value
  7555. ------------
  7556.  
  7557. Zero.  This function always works.
  7558.  
  7559. 
  7560. File: libc,  Node: __dpmi_get_segment_base_address,  Next: __dpmi_get_segment_limit,  Prev: __dpmi_get_real_mode_interrupt_vector,  Up: Alphabetical List
  7561.  
  7562. __dpmi_get_segment_base_address
  7563. ===============================
  7564.  
  7565. Syntax
  7566. ------
  7567.  
  7568.      #include <dpmi.h>
  7569.      
  7570.      int __dpmi_get_segment_base_address(int _selector, unsigned long *_addr);
  7571.  
  7572. Description
  7573. -----------
  7574.  
  7575. Please refer to *Note DPMI Specification:: for details on DPMI function
  7576. call operation.  Also see *Note DPMI Overview:: for general information.
  7577.  
  7578. DPMI function AX = 0x0006
  7579.  
  7580. The physical base address of the selector is stored in *ADDR.
  7581.  
  7582. Return Value
  7583. ------------
  7584.  
  7585. -1 on error, else zero.
  7586.  
  7587. Example
  7588. -------
  7589.  
  7590.      unsigned long addr;
  7591.      if (__dpmi_get_segment_base_address(selector, &addr))
  7592.        ...
  7593.  
  7594. 
  7595. File: libc,  Node: __dpmi_get_segment_limit,  Next: __dpmi_get_selector_increment_value,  Prev: __dpmi_get_segment_base_address,  Up: Alphabetical List
  7596.  
  7597. __dpmi_get_segment_limit
  7598. ========================
  7599.  
  7600. Syntax
  7601. ------
  7602.  
  7603.      #include <dpmi.h>
  7604.      
  7605.      unsigned __dpmi_get_segment_limit(int _selector);
  7606.  
  7607. Description
  7608. -----------
  7609.  
  7610. Please refer to *Note DPMI Specification:: for details on DPMI function
  7611. call operation.  Also see *Note DPMI Overview:: for general information.
  7612.  
  7613. Return Value
  7614. ------------
  7615.  
  7616. The limit of the segment, as returned by the `lsl' opcode.
  7617.  
  7618. 
  7619. File: libc,  Node: __dpmi_get_selector_increment_value,  Next: __dpmi_get_state_of_debug_watchpoint,  Prev: __dpmi_get_segment_limit,  Up: Alphabetical List
  7620.  
  7621. __dpmi_get_selector_increment_value
  7622. ===================================
  7623.  
  7624. Syntax
  7625. ------
  7626.  
  7627.      #include <dpmi.h>
  7628.      
  7629.      int __dpmi_get_selector_increment_value(void);
  7630.  
  7631. Description
  7632. -----------
  7633.  
  7634. Please refer to *Note DPMI Specification:: for details on DPMI function
  7635. call operation.  Also see *Note DPMI Overview:: for general information.
  7636.  
  7637. DPMI function AX = 0x0003
  7638.  
  7639. Return Value
  7640. ------------
  7641.  
  7642. The value to return to each selector allocated by
  7643. __dpmi_allocate_ldt_descriptors to get the next one.
  7644.  
  7645. 
  7646. File: libc,  Node: __dpmi_get_state_of_debug_watchpoint,  Next: __dpmi_get_state_save_restore_addr,  Prev: __dpmi_get_selector_increment_value,  Up: Alphabetical List
  7647.  
  7648. __dpmi_get_state_of_debug_watchpoint
  7649. ====================================
  7650.  
  7651. Syntax
  7652. ------
  7653.  
  7654.      #include <dpmi.h>
  7655.      
  7656.      int __dpmi_get_state_of_debug_watchpoint(unsigned long _handle, int *_status);
  7657.  
  7658. Description
  7659. -----------
  7660.  
  7661. Please refer to *Note DPMI Specification:: for details on DPMI function
  7662. call operation.  Also see *Note DPMI Overview:: for general information.
  7663.  
  7664. DPMI function AX = 0x0b02
  7665.  
  7666. Gets the state of the watchpoint.  Pass handle, fills in status (0=not
  7667. encountered, 1=encountered).
  7668.  
  7669. Return Value
  7670. ------------
  7671.  
  7672. -1 on error, else zero.
  7673.  
  7674. 
  7675. File: libc,  Node: __dpmi_get_state_save_restore_addr,  Next: __dpmi_get_vendor_specific_api_entry_point,  Prev: __dpmi_get_state_of_debug_watchpoint,  Up: Alphabetical List
  7676.  
  7677. __dpmi_get_state_save_restore_addr
  7678. ==================================
  7679.  
  7680. Syntax
  7681. ------
  7682.  
  7683.      #include <dpmi.h>
  7684.      
  7685.      int __dpmi_get_state_save_restore_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);
  7686.  
  7687. Description
  7688. -----------
  7689.  
  7690. Please refer to *Note DPMI Specification:: for details on DPMI function
  7691. call operation.  Also see *Note DPMI Overview:: for general information.
  7692.  
  7693. DPMI function AX = 0x0305
  7694.  
  7695. Read the spec for info.
  7696.  
  7697. Return Value
  7698. ------------
  7699.  
  7700. The number of bytes required to save state.
  7701.  
  7702. 
  7703. File: libc,  Node: __dpmi_get_vendor_specific_api_entry_point,  Next: __dpmi_get_version,  Prev: __dpmi_get_state_save_restore_addr,  Up: Alphabetical List
  7704.  
  7705. __dpmi_get_vendor_specific_api_entry_point
  7706. ==========================================
  7707.  
  7708. Syntax
  7709. ------
  7710.  
  7711.      #include <dpmi.h>
  7712.      
  7713.      int __dpmi_get_vendor_specific_api_entry_point(char *_id, __dpmi_paddr *_api);
  7714.  
  7715. Description
  7716. -----------
  7717.  
  7718. Please refer to *Note DPMI Specification:: for details on DPMI function
  7719. call operation.  Also see *Note DPMI Overview:: for general information.
  7720.  
  7721. DPMI function AX = 0x0a00
  7722.  
  7723. Look up a vendor-specific function, given the *name* of the function.
  7724.  
  7725. Return Value
  7726. ------------
  7727.  
  7728. -1 on error, else zero.
  7729.  
  7730. 
  7731. File: libc,  Node: __dpmi_get_version,  Next: __dpmi_get_virtual_interrupt_state,  Prev: __dpmi_get_vendor_specific_api_entry_point,  Up: Alphabetical List
  7732.  
  7733. __dpmi_get_version
  7734. ==================
  7735.  
  7736. Syntax
  7737. ------
  7738.  
  7739.      #include <dpmi.h>
  7740.      
  7741.      int __dpmi_get_version(__dpmi_version_ret *_ret);
  7742.  
  7743. Description
  7744. -----------
  7745.  
  7746. Please refer to *Note DPMI Specification:: for details on DPMI function
  7747. call operation.  Also see *Note DPMI Overview:: for general information.
  7748.  
  7749. DPMI function AX = 0x0400
  7750.  
  7751. Fills in version information.  The flags are as follows:
  7752.  
  7753.      ---- ---X = 0=16-bit host  1=32-bit host
  7754.      ---- --X- = 0=V86 used for reflected ints, 1=real mode
  7755.      ---- -X-- = 0=no virtual memory, 1=virtual memory supported
  7756.  
  7757. The cpu is 2=80286, 3=80386, 4=80486, etc.
  7758.  
  7759. DPMI 0.9 returns major=0 and minor=0x5a.
  7760.  
  7761. Return Value
  7762. ------------
  7763.  
  7764. Zero.  This always works.
  7765.  
  7766. 
  7767. File: libc,  Node: __dpmi_get_virtual_interrupt_state,  Next: __dpmi_install_resident_service_provider_callback,  Prev: __dpmi_get_version,  Up: Alphabetical List
  7768.  
  7769. __dpmi_get_virtual_interrupt_state
  7770. ==================================
  7771.  
  7772. Syntax
  7773. ------
  7774.  
  7775.      #include <dpmi.h>
  7776.      
  7777.      int __dpmi_get_virtual_interrupt_state(void);
  7778.  
  7779. Description
  7780. -----------
  7781.  
  7782. Please refer to *Note DPMI Specification:: for details on DPMI function
  7783. call operation.  Also see *Note DPMI Overview:: for general information.
  7784.  
  7785. DPMI function AX = 0x0902
  7786.  
  7787. Return Value
  7788. ------------
  7789.  
  7790. This function returns the current interrupt flag (1=enabled).
  7791.  
  7792. 
  7793. File: libc,  Node: __dpmi_install_resident_service_provider_callback,  Next: __dpmi_int,  Prev: __dpmi_get_virtual_interrupt_state,  Up: Alphabetical List
  7794.  
  7795. __dpmi_install_resident_service_provider_callback
  7796. =================================================
  7797.  
  7798. Syntax
  7799. ------
  7800.  
  7801.      #include <dpmi.h>
  7802.      
  7803.      int __dpmi_install_resident_service_provider_callback(__dpmi_callback_info *_info);
  7804.  
  7805. Description
  7806. -----------
  7807.  
  7808. Please refer to *Note DPMI Specification:: for details on DPMI function
  7809. call operation.  Also see *Note DPMI Overview:: for general information.
  7810.  
  7811. DPMI function AX = 0x0c00 (DPMI 1.0 only)
  7812.  
  7813. See the spec.
  7814.  
  7815. Return Value
  7816. ------------
  7817.  
  7818. -1 on error, else zero.
  7819.  
  7820. 
  7821. File: libc,  Node: __dpmi_int,  Next: __dpmi_lock_linear_region,  Prev: __dpmi_install_resident_service_provider_callback,  Up: Alphabetical List
  7822.  
  7823. __dpmi_int
  7824. ==========
  7825.  
  7826. Syntax
  7827. ------
  7828.  
  7829.      #include <dpmi.h>
  7830.      
  7831.      int __dpmi_int(int _vector, __dpmi_regs *_regs);
  7832.  
  7833. Description
  7834. -----------
  7835.  
  7836. Please refer to *Note DPMI Specification:: for details on DPMI function
  7837. call operation.  Also see *Note DPMI Overview:: for general information.
  7838.  
  7839. DPMI function AX = 0x0300
  7840.  
  7841. This function performs a software interrupt in real mode after filling
  7842. in *most* the registers from the given structure.  %ss, %esp, and
  7843. %eflags are automatically taken care of, unlike *Note
  7844. __dpmi_simulate_real_mode_interrupt::.
  7845.  
  7846. The following variables can be used to tune this function.  By default,
  7847. these variables are all zero.
  7848.  
  7849. `__dpmi_int_ss'
  7850. `__dpmi_int_sp'
  7851. `__dpmi_int_flags'
  7852.      These hold the values stored in the appropriate field in the
  7853.      `__dpmi_regs' structure.
  7854.  
  7855. Return Value
  7856. ------------
  7857.  
  7858. -1 on error, else zero.
  7859.  
  7860. 
  7861. File: libc,  Node: __dpmi_lock_linear_region,  Next: __dpmi_map_conventional_memory_in_memory_block,  Prev: __dpmi_int,  Up: Alphabetical List
  7862.  
  7863. __dpmi_lock_linear_region
  7864. =========================
  7865.  
  7866. Syntax
  7867. ------
  7868.  
  7869.      #include <dpmi.h>
  7870.      
  7871.      int __dpmi_lock_linear_region(__dpmi_meminfo *_info);
  7872.  
  7873. Description
  7874. -----------
  7875.  
  7876. Please refer to *Note DPMI Specification:: for details on DPMI function
  7877. call operation.  Also see *Note DPMI Overview:: for general information.
  7878.  
  7879. DPMI function AX = 0x0600
  7880.  
  7881. This function locks virtual memory, to prevent page faults during
  7882. hardware interrupts.  Pass address and size (in bytes).
  7883.  
  7884. Return Value
  7885. ------------
  7886.  
  7887. -1 on error, else zero.
  7888.  
  7889. 
  7890. File: libc,  Node: __dpmi_map_conventional_memory_in_memory_block,  Next: __dpmi_map_device_in_memory_block,  Prev: __dpmi_lock_linear_region,  Up: Alphabetical List
  7891.  
  7892. __dpmi_map_conventional_memory_in_memory_block
  7893. ==============================================
  7894.  
  7895. Syntax
  7896. ------
  7897.  
  7898.      #include <dpmi.h>
  7899.      
  7900.      int __dpmi_map_conventional_memory_in_memory_block(__dpmi_meminfo *_info, unsigned long _physaddr);
  7901.  
  7902. Description
  7903. -----------
  7904.  
  7905. Please refer to *Note DPMI Specification:: for details on DPMI function
  7906. call operation.  Also see *Note DPMI Overview:: for general information.
  7907.  
  7908. DPMI function AX = 0x0509 (DPMI 1.0 only)
  7909.  
  7910. This function maps conventional memory (even when virtualized) to
  7911. virtual memory.  Pass the handle, offset, and number of pages.
  7912.  
  7913. Return Value
  7914. ------------
  7915.  
  7916. -1 on error, else zero.
  7917.  
  7918. 
  7919. File: libc,  Node: __dpmi_map_device_in_memory_block,  Next: __dpmi_mark_page_as_demand_paging_candidate,  Prev: __dpmi_map_conventional_memory_in_memory_block,  Up: Alphabetical List
  7920.  
  7921. __dpmi_map_device_in_memory_block
  7922. =================================
  7923.  
  7924. Syntax
  7925. ------
  7926.  
  7927.      #include <dpmi.h>
  7928.      
  7929.      int __dpmi_map_device_in_memory_block(__dpmi_meminfo *_info, unsigned long *_physaddr);
  7930.  
  7931. Description
  7932. -----------
  7933.  
  7934. Please refer to *Note DPMI Specification:: for details on DPMI function
  7935. call operation.  Also see *Note DPMI Overview:: for general information.
  7936.  
  7937. DPMI function AX = 0x0508 (DPMI 1.0 only)
  7938.  
  7939. This function maps a physical address range to virtual memory.  Pass
  7940. the handle, offset relative to the start of the block, and number of
  7941. pages to map.
  7942.  
  7943. Return Value
  7944. ------------
  7945.  
  7946. -1 on error, else zero.
  7947.  
  7948. 
  7949. File: libc,  Node: __dpmi_mark_page_as_demand_paging_candidate,  Next: __dpmi_mark_real_mode_region_as_pageable,  Prev: __dpmi_map_device_in_memory_block,  Up: Alphabetical List
  7950.  
  7951. __dpmi_mark_page_as_demand_paging_candidate
  7952. ===========================================
  7953.  
  7954. Syntax
  7955. ------
  7956.  
  7957.      #include <dpmi.h>
  7958.      
  7959.      int __dpmi_mark_page_as_demand_paging_candidate(__dpmi_meminfo *_info);
  7960.  
  7961. Description
  7962. -----------
  7963.  
  7964. Please refer to *Note DPMI Specification:: for details on DPMI function
  7965. call operation.  Also see *Note DPMI Overview:: for general information.
  7966.  
  7967. DPMI function AX = 0x0702
  7968.  
  7969. Advises the server that certain pages are unlikely to be used soon.
  7970. Set address and size (in bytes).
  7971.  
  7972. Return Value
  7973. ------------
  7974.  
  7975. -1 on error, else zero.
  7976.  
  7977. 
  7978. File: libc,  Node: __dpmi_mark_real_mode_region_as_pageable,  Next: __dpmi_physical_address_mapping,  Prev: __dpmi_mark_page_as_demand_paging_candidate,  Up: Alphabetical List
  7979.  
  7980. __dpmi_mark_real_mode_region_as_pageable
  7981. ========================================
  7982.  
  7983. Syntax
  7984. ------
  7985.  
  7986.      #include <dpmi.h>
  7987.      
  7988.      int __dpmi_mark_real_mode_region_as_pageable(__dpmi_meminfo *_info);
  7989.  
  7990. Description
  7991. -----------
  7992.  
  7993. Please refer to *Note DPMI Specification:: for details on DPMI function
  7994. call operation.  Also see *Note DPMI Overview:: for general information.
  7995.  
  7996. DPMI function AX = 0x0602
  7997.  
  7998. This function advises the host that the given pages are suitable for
  7999. page-out.  Pass address and size (in bytes).
  8000.  
  8001. Return Value
  8002. ------------
  8003.  
  8004. -1 on error, else zero.
  8005.  
  8006. 
  8007. File: libc,  Node: __dpmi_physical_address_mapping,  Next: __dpmi_relock_real_mode_region,  Prev: __dpmi_mark_real_mode_region_as_pageable,  Up: Alphabetical List
  8008.  
  8009. __dpmi_physical_address_mapping
  8010. ===============================
  8011.  
  8012. Syntax
  8013. ------
  8014.  
  8015.      #include <dpmi.h>
  8016.      
  8017.      int __dpmi_physical_address_mapping(__dpmi_meminfo *_info);
  8018.  
  8019. Description
  8020. -----------
  8021.  
  8022. Please refer to *Note DPMI Specification:: for details on DPMI function
  8023. call operation.  Also see *Note DPMI Overview:: for general information.
  8024.  
  8025. DPMI function AX = 0x0800
  8026.  
  8027. Maps a physical device (like a graphics buffer) to linear memory.  Fill
  8028. in the physical address and size (in bytes).  On return, the address is
  8029. the linear address to use.
  8030.  
  8031. Return Value
  8032. ------------
  8033.  
  8034. -1 on error, else zero.
  8035.  
  8036. 
  8037. File: libc,  Node: __dpmi_relock_real_mode_region,  Next: __dpmi_reset_debug_watchpoint,  Prev: __dpmi_physical_address_mapping,  Up: Alphabetical List
  8038.  
  8039. __dpmi_relock_real_mode_region
  8040. ==============================
  8041.  
  8042. Syntax
  8043. ------
  8044.  
  8045.      #include <dpmi.h>
  8046.      
  8047.      int __dpmi_relock_real_mode_region(__dpmi_meminfo *_info);
  8048.  
  8049. Description
  8050. -----------
  8051.  
  8052. Please refer to *Note DPMI Specification:: for details on DPMI function
  8053. call operation.  Also see *Note DPMI Overview:: for general information.
  8054.  
  8055. DPMI function AX = 0x0603
  8056.  
  8057. This function relocks the pages unlocked with *Note
  8058. __dpmi_mark_real_mode_region_as_pageable::.  Pass address and size (in
  8059. bytes).
  8060.  
  8061. Return Value
  8062. ------------
  8063.  
  8064. -1 on error, else zero.
  8065.  
  8066. 
  8067. File: libc,  Node: __dpmi_reset_debug_watchpoint,  Next: __dpmi_resize_dos_memory,  Prev: __dpmi_relock_real_mode_region,  Up: Alphabetical List
  8068.  
  8069. __dpmi_reset_debug_watchpoint
  8070. =============================
  8071.  
  8072. Syntax
  8073. ------
  8074.  
  8075.      #include <dpmi.h>
  8076.      
  8077.      int __dpmi_reset_debug_watchpoint
  8078.  
  8079. Description
  8080. -----------
  8081.  
  8082. Please refer to *Note DPMI Specification:: for details on DPMI function
  8083. call operation.  Also see *Note DPMI Overview:: for general information.
  8084.  
  8085. DPMI function AX = 0x0b03
  8086.  
  8087. Resets a watchpoint.
  8088.  
  8089. Return Value
  8090. ------------
  8091.  
  8092. -1 on error, else zero.
  8093.  
  8094. 
  8095. File: libc,  Node: __dpmi_resize_dos_memory,  Next: __dpmi_resize_linear_memory,  Prev: __dpmi_reset_debug_watchpoint,  Up: Alphabetical List
  8096.  
  8097. __dpmi_resize_dos_memory
  8098. ========================
  8099.  
  8100. Syntax
  8101. ------
  8102.  
  8103.      #include <dpmi.h>
  8104.      
  8105.      int __dpmi_resize_dos_memory(int _selector, int _newpara, int *_ret_max);
  8106.  
  8107. Description
  8108. -----------
  8109.  
  8110. Please refer to *Note DPMI Specification:: for details on DPMI function
  8111. call operation.  Also see *Note DPMI Overview:: for general information.
  8112.  
  8113. DPMI function AX = 0x0102
  8114.  
  8115. This function resizes a dos memory block.  Remember to pass the
  8116. selector, and not the segment.  If this call fails, _RET_MAX contains
  8117. the largest number of paragraphs available.
  8118.  
  8119. Return Value
  8120. ------------
  8121.  
  8122. -1 on error, else zero.
  8123.  
  8124. 
  8125. File: libc,  Node: __dpmi_resize_linear_memory,  Next: __dpmi_resize_memory,  Prev: __dpmi_resize_dos_memory,  Up: Alphabetical List
  8126.  
  8127. __dpmi_resize_linear_memory
  8128. ===========================
  8129.  
  8130. Syntax
  8131. ------
  8132.  
  8133.      #include <dpmi.h>
  8134.      
  8135.      int __dpmi_resize_linear_memory(__dpmi_meminfo *_info, int _commit);
  8136.  
  8137. Description
  8138. -----------
  8139.  
  8140. Please refer to *Note DPMI Specification:: for details on DPMI function
  8141. call operation.  Also see *Note DPMI Overview:: for general information.
  8142.  
  8143. DPMI function AX = 0x0505 (DPMI 1.0 only)
  8144.  
  8145. This function resizes a memory block.  Pass the handle and new size.
  8146. Bit 0 of _commit is 1 for committed pages; bit 1 is 1 to automatically
  8147. update descriptors.  It returns a new handle and base address.
  8148.  
  8149. Return Value
  8150. ------------
  8151.  
  8152. -1 on error, else zero.
  8153.  
  8154. 
  8155. File: libc,  Node: __dpmi_resize_memory,  Next: __dpmi_segment_to_descriptor,  Prev: __dpmi_resize_linear_memory,  Up: Alphabetical List
  8156.  
  8157. __dpmi_resize_memory
  8158. ====================
  8159.  
  8160. Syntax
  8161. ------
  8162.  
  8163.      #include <dpmi.h>
  8164.      
  8165.      int __dpmi_resize_memory
  8166.  
  8167. Description
  8168. -----------
  8169.  
  8170. Please refer to *Note DPMI Specification:: for details on DPMI function
  8171. call operation.  Also see *Note DPMI Overview:: for general information.
  8172.  
  8173. DPMI function AX = 0x0503
  8174.  
  8175. This function changes the size of a virtual memory block.  You must
  8176. pass the handle and size fields.  It may change the base address also;
  8177. beware of debugging breakpoints and locked memory.  It will return a
  8178. new handle.
  8179.  
  8180. Return Value
  8181. ------------
  8182.  
  8183. -1 on error, else zero.
  8184.  
  8185. 
  8186. File: libc,  Node: __dpmi_segment_to_descriptor,  Next: __dpmi_serialize_on_shared_memory,  Prev: __dpmi_resize_memory,  Up: Alphabetical List
  8187.  
  8188. __dpmi_segment_to_descriptor
  8189. ============================
  8190.  
  8191. Syntax
  8192. ------
  8193.  
  8194.      #include <dpmi.h>
  8195.      
  8196.      int __dpmi_segment_to_descriptor
  8197.  
  8198. Description
  8199. -----------
  8200.  
  8201. Please refer to *Note DPMI Specification:: for details on DPMI function
  8202. call operation.  Also see *Note DPMI Overview:: for general information.
  8203.  
  8204. DPMI function AX = 0x0002
  8205.  
  8206. This function returns a selector that maps to what the real-mode
  8207. segment provided would have referenced.  Warning: this is a scarce
  8208. resource.
  8209.  
  8210. Return Value
  8211. ------------
  8212.  
  8213. -1 on error, else the selector.
  8214.  
  8215. Example
  8216. -------
  8217.  
  8218.      short video = __dpmi_segment_to_descriptor(0xa000);
  8219.  
  8220. 
  8221. File: libc,  Node: __dpmi_serialize_on_shared_memory,  Next: __dpmi_set_coprocessor_emulation,  Prev: __dpmi_segment_to_descriptor,  Up: Alphabetical List
  8222.  
  8223. __dpmi_serialize_on_shared_memory
  8224. =================================
  8225.  
  8226. Syntax
  8227. ------
  8228.  
  8229.      #include <dpmi.h>
  8230.      
  8231.      int __dpmi_serialize_on_shared_memory(unsigned long _handle, int _flags);
  8232.  
  8233. Description
  8234. -----------
  8235.  
  8236. Please refer to *Note DPMI Specification:: for details on DPMI function
  8237. call operation.  Also see *Note DPMI Overview:: for general information.
  8238.  
  8239. DPMI function AX = 0x0d02 (DPMI 1.0 only)
  8240.  
  8241. See the spec.
  8242.  
  8243. Return Value
  8244. ------------
  8245.  
  8246. -1 on error, else zero.
  8247.  
  8248. 
  8249. File: libc,  Node: __dpmi_set_coprocessor_emulation,  Next: __dpmi_set_debug_watchpoint,  Prev: __dpmi_serialize_on_shared_memory,  Up: Alphabetical List
  8250.  
  8251. __dpmi_set_coprocessor_emulation
  8252. ================================
  8253.  
  8254. Syntax
  8255. ------
  8256.  
  8257.      #include <dpmi.h>
  8258.      
  8259.      int __dpmi_set_coprocessor_emulation(int _flags);
  8260.  
  8261. Description
  8262. -----------
  8263.  
  8264. Please refer to *Note DPMI Specification:: for details on DPMI function
  8265. call operation.  Also see *Note DPMI Overview:: for general information.
  8266.  
  8267. DPMI function AX = 0x0e01 (DPMI 1.0 only)
  8268.  
  8269. Return Value
  8270. ------------
  8271.  
  8272. -1 on errors, else zero.
  8273.  
  8274. 
  8275. File: libc,  Node: __dpmi_set_debug_watchpoint,  Next: __dpmi_set_descriptor,  Prev: __dpmi_set_coprocessor_emulation,  Up: Alphabetical List
  8276.  
  8277. __dpmi_set_debug_watchpoint
  8278. ===========================
  8279.  
  8280. Syntax
  8281. ------
  8282.  
  8283.      #include <dpmi.h>
  8284.      
  8285.      int __dpmi_set_debug_watchpoint(__dpmi_meminfo *_info, int _type);
  8286.  
  8287. Description
  8288. -----------
  8289.  
  8290. Please refer to *Note DPMI Specification:: for details on DPMI function
  8291. call operation.  Also see *Note DPMI Overview:: for general information.
  8292.  
  8293. DPMI function AX = 0x0b00
  8294.  
  8295. Set a debug breakpoint.  Type is 0 for execute, 1 for write, and 2 for
  8296. access.  Fill in address and size (1,2,4 bytes).  Server fills in
  8297. handle.
  8298.  
  8299. Return Value
  8300. ------------
  8301.  
  8302. -1 on error, else zero.
  8303.  
  8304. 
  8305. File: libc,  Node: __dpmi_set_descriptor,  Next: __dpmi_set_descriptor_access_rights,  Prev: __dpmi_set_debug_watchpoint,  Up: Alphabetical List
  8306.  
  8307. __dpmi_set_descriptor
  8308. =====================
  8309.  
  8310. Syntax
  8311. ------
  8312.  
  8313.      #include <dpmi.h>
  8314.      
  8315.      int __dpmi_set_descriptor(int _selector, void *_buffer);
  8316.  
  8317. Description
  8318. -----------
  8319.  
  8320. Please refer to *Note DPMI Specification:: for details on DPMI function
  8321. call operation.  Also see *Note DPMI Overview:: for general information.
  8322.  
  8323. DPMI function AX = 0x000c
  8324.  
  8325. This function sets the selector's parameters.  *Note
  8326. __dpmi_get_descriptor::.
  8327.  
  8328. Return Value
  8329. ------------
  8330.  
  8331. -1 on error, else zero.
  8332.  
  8333. 
  8334. File: libc,  Node: __dpmi_set_descriptor_access_rights,  Next: __dpmi_set_extended_exception_handler_vector_pm,  Prev: __dpmi_set_descriptor,  Up: Alphabetical List
  8335.  
  8336. __dpmi_set_descriptor_access_rights
  8337. ===================================
  8338.  
  8339. Syntax
  8340. ------
  8341.  
  8342.      #include <dpmi.h>
  8343.      
  8344.      int __dpmi_set_descriptor_access_rights(int _selector, int _rights);
  8345.  
  8346. Description
  8347. -----------
  8348.  
  8349. Please refer to *Note DPMI Specification:: for details on DPMI function
  8350. call operation.  Also see *Note DPMI Overview:: for general information.
  8351.  
  8352. DPMI function AX = 0x0009
  8353.  
  8354. This sets the rights of _SELECTOR to _RIGHTS.
  8355.  
  8356.      ---- ---- ---- ---X = 0=not accessed, 1=accessed
  8357.      ---- ---- ---- --X- = data: 0=read, 1=r/w; code: 1=readable
  8358.      ---- ---- ---- -X-- = data: 0=expand-up, 1=expand-down; code: 0=non-conforming
  8359.      ---- ---- ---- X--- = 0=data, 1=code
  8360.      ---- ---- ---1 ---- = must be 1
  8361.      ---- ---- -XX- ---- = priviledge level (must equal CPL)
  8362.      ---- ---- X--- ---- = 0=absent, 1=present
  8363.      ---X ---- ---- ---- = available for the user
  8364.      --0- ---- ---- ---- = must be 0
  8365.      -X-- ---- ---- ---- = 0=16-bit 1=32-bit
  8366.      X--- ---- ---- ---- = 0=byte granular (small) 1=page-granular (big)
  8367.  
  8368. Return Value
  8369. ------------
  8370.  
  8371. -1 on error, else zero.
  8372.  
  8373. 
  8374. File: libc,  Node: __dpmi_set_extended_exception_handler_vector_pm,  Next: __dpmi_set_extended_exception_handler_vector_rm,  Prev: __dpmi_set_descriptor_access_rights,  Up: Alphabetical List
  8375.  
  8376. __dpmi_set_extended_exception_handler_vector_pm
  8377. ===============================================
  8378.  
  8379. Syntax
  8380. ------
  8381.  
  8382.      #include <dpmi.h>
  8383.      
  8384.      int __dpmi_set_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);
  8385.  
  8386. Description
  8387. -----------
  8388.  
  8389. Please refer to *Note DPMI Specification:: for details on DPMI function
  8390. call operation.  Also see *Note DPMI Overview:: for general information.
  8391.  
  8392. DPMI function AX = 0x0212 (DPMI 1.0 only)
  8393.  
  8394. This function installs a handler for protected-mode exceptions.
  8395.  
  8396. Return Value
  8397. ------------
  8398.  
  8399. -1 on error, else zero.
  8400.  
  8401. 
  8402. File: libc,  Node: __dpmi_set_extended_exception_handler_vector_rm,  Next: __dpmi_set_multiple_descriptors,  Prev: __dpmi_set_extended_exception_handler_vector_pm,  Up: Alphabetical List
  8403.  
  8404. __dpmi_set_extended_exception_handler_vector_rm
  8405. ===============================================
  8406.  
  8407. Syntax
  8408. ------
  8409.  
  8410.      #include <dpmi.h>
  8411.      
  8412.      int __dpmi_set_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);
  8413.  
  8414. Description
  8415. -----------
  8416.  
  8417. Please refer to *Note DPMI Specification:: for details on DPMI function
  8418. call operation.  Also see *Note DPMI Overview:: for general information.
  8419.  
  8420. DPMI function AX = 0x0213 (DPMI 1.0 only)
  8421.  
  8422. This function installs a handler for real-mode exceptions.
  8423.  
  8424. Return Value
  8425. ------------
  8426.  
  8427. -1 on error, else zero.
  8428.  
  8429. 
  8430. File: libc,  Node: __dpmi_set_multiple_descriptors,  Next: __dpmi_set_page_attributes,  Prev: __dpmi_set_extended_exception_handler_vector_rm,  Up: Alphabetical List
  8431.  
  8432. __dpmi_set_multiple_descriptors
  8433. ===============================
  8434.  
  8435. Syntax
  8436. ------
  8437.  
  8438.      #include <dpmi.h>
  8439.      
  8440.      int __dpmi_set_multiple_descriptors(int _count, void *_buffer);
  8441.  
  8442. Description
  8443. -----------
  8444.  
  8445. Please refer to *Note DPMI Specification:: for details on DPMI function
  8446. call operation.  Also see *Note DPMI Overview:: for general information.
  8447.  
  8448. DPMI function AX = 0x000f (DPMI 1.0 only)
  8449.  
  8450. This function sets multiple descriptors.  Buffer usage is like *Note
  8451. __dpmi_get_multiple_descriptors::, but the caller fills in everything
  8452. before calling.
  8453.  
  8454. Return Value
  8455. ------------
  8456.  
  8457. Returns _count if successful, the negative of # descriptors set if
  8458. failure.
  8459.  
  8460. 
  8461. File: libc,  Node: __dpmi_set_page_attributes,  Next: __dpmi_set_processor_exception_handler_vector,  Prev: __dpmi_set_multiple_descriptors,  Up: Alphabetical List
  8462.  
  8463. __dpmi_set_page_attributes
  8464. ==========================
  8465.  
  8466. Syntax
  8467. ------
  8468.  
  8469.      #include <dpmi.h>
  8470.      
  8471.      int __dpmi_set_page_attributes(__dpmi_meminfo *_info, short *_buffer);
  8472.  
  8473. Description
  8474. -----------
  8475.  
  8476. Please refer to *Note DPMI Specification:: for details on DPMI function
  8477. call operation.  Also see *Note DPMI Overview:: for general information.
  8478.  
  8479. DPMI function AX = 0x0507 (DPMI 1.0 only)
  8480.  
  8481. Sets page attributes.  Pass handle, offset within block in .address,
  8482. and number of pages in .count.  Buffer points to new attributes (see
  8483. spec).
  8484.  
  8485. Return Value
  8486. ------------
  8487.  
  8488. -1 on error, else zero.
  8489.  
  8490. 
  8491. File: libc,  Node: __dpmi_set_processor_exception_handler_vector,  Next: __dpmi_set_protected_mode_interrupt_vector,  Prev: __dpmi_set_page_attributes,  Up: Alphabetical List
  8492.  
  8493. __dpmi_set_processor_exception_handler_vector
  8494. =============================================
  8495.  
  8496. Syntax
  8497. ------
  8498.  
  8499.      #include <dpmi.h>
  8500.      
  8501.      int __dpmi_set_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);
  8502.  
  8503. Description
  8504. -----------
  8505.  
  8506. Please refer to *Note DPMI Specification:: for details on DPMI function
  8507. call operation.  Also see *Note DPMI Overview:: for general information.
  8508.  
  8509. DPMI function AX = 0x0203
  8510.  
  8511. This function installs a handler for protected mode exceptions (not
  8512. interrupts).  You must pass a selector:offset pair.
  8513.  
  8514. Return Value
  8515. ------------
  8516.  
  8517. -1 on error, else zero.
  8518.  
  8519. 
  8520. File: libc,  Node: __dpmi_set_protected_mode_interrupt_vector,  Next: __dpmi_set_real_mode_interrupt_vector,  Prev: __dpmi_set_processor_exception_handler_vector,  Up: Alphabetical List
  8521.  
  8522. __dpmi_set_protected_mode_interrupt_vector
  8523. ==========================================
  8524.  
  8525. Syntax
  8526. ------
  8527.  
  8528.      #include <dpmi.h>
  8529.      
  8530.      int __dpmi_set_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);
  8531.  
  8532. Description
  8533. -----------
  8534.  
  8535. Please refer to *Note DPMI Specification:: for details on DPMI function
  8536. call operation.  Also see *Note DPMI Overview:: for general information.
  8537.  
  8538. DPMI function AX = 0x0205
  8539.  
  8540. This function installs a protected-mode interrupt (not exception)
  8541. handler.  You must pass a selector:offset pair.  Hardware interrupts
  8542. will always be reflected to protected mode if you install a handler.
  8543. You must explicitely `sti' before `iret' because `iret' won't always
  8544. restore interrupts in a virtual environment.
  8545.  
  8546. Return Value
  8547. ------------
  8548.  
  8549. -1 on error, else zero.
  8550.  
  8551. 
  8552. File: libc,  Node: __dpmi_set_real_mode_interrupt_vector,  Next: __dpmi_set_segment_base_address,  Prev: __dpmi_set_protected_mode_interrupt_vector,  Up: Alphabetical List
  8553.  
  8554. __dpmi_set_real_mode_interrupt_vector
  8555. =====================================
  8556.  
  8557. Syntax
  8558. ------
  8559.  
  8560.      #include <dpmi.h>
  8561.      
  8562.      int __dpmi_set_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);
  8563.  
  8564. Description
  8565. -----------
  8566.  
  8567. Please refer to *Note DPMI Specification:: for details on DPMI function
  8568. call operation.  Also see *Note DPMI Overview:: for general information.
  8569.  
  8570. DPMI function AX = 0x0201
  8571.  
  8572. This function sets a real-mode interrupt vector.  You must pass a
  8573. segment:offset pair, not a selector.
  8574.  
  8575. Bits [31:8] in the vector number are silently ignored.
  8576.  
  8577. Return Value
  8578. ------------
  8579.  
  8580. Zero.  This function always works.
  8581.  
  8582. 
  8583. File: libc,  Node: __dpmi_set_segment_base_address,  Next: __dpmi_set_segment_limit,  Prev: __dpmi_set_real_mode_interrupt_vector,  Up: Alphabetical List
  8584.  
  8585. __dpmi_set_segment_base_address
  8586. ===============================
  8587.  
  8588. Syntax
  8589. ------
  8590.  
  8591.      #include <dpmi.h>
  8592.      
  8593.      int __dpmi_set_segment_base_address(int _selector, unsigned _address);
  8594.  
  8595. Description
  8596. -----------
  8597.  
  8598. Please refer to *Note DPMI Specification:: for details on DPMI function
  8599. call operation.  Also see *Note DPMI Overview:: for general information.
  8600.  
  8601. DPMI function AX = 0x0007
  8602.  
  8603. This function sets the base address of the _SELECTOR to _ADDRESS.
  8604.  
  8605. Return Value
  8606. ------------
  8607.  
  8608. -1 on error, else zero.
  8609.  
  8610. 
  8611. File: libc,  Node: __dpmi_set_segment_limit,  Next: __dpmi_simulate_real_mode_interrupt,  Prev: __dpmi_set_segment_base_address,  Up: Alphabetical List
  8612.  
  8613. __dpmi_set_segment_limit
  8614. ========================
  8615.  
  8616. Syntax
  8617. ------
  8618.  
  8619.      #include <dpmi.h>
  8620.      
  8621.      int __dpmi_set_segment_limit(int _selector, unsigned _address);
  8622.  
  8623. Description
  8624. -----------
  8625.  
  8626. Please refer to *Note DPMI Specification:: for details on DPMI function
  8627. call operation.  Also see *Note DPMI Overview:: for general information.
  8628.  
  8629. DPMI function AX = 0x0008
  8630.  
  8631. This function sets the highest valid address in the segment referenced
  8632. by _SELECTOR.  For example, if you pass 0xfffff, the highest valid
  8633. address is 0xfffff.  Note: if you pass a number <= 64K, the segment
  8634. changes to "non-big", and may cause unexpected problems.
  8635.  
  8636. Return Value
  8637. ------------
  8638.  
  8639. -1 on error, else zero.
  8640.  
  8641. 
  8642. File: libc,  Node: __dpmi_simulate_real_mode_interrupt,  Next: __dpmi_simulate_real_mode_procedure_iret,  Prev: __dpmi_set_segment_limit,  Up: Alphabetical List
  8643.  
  8644. __dpmi_simulate_real_mode_interrupt
  8645. ===================================
  8646.  
  8647. Syntax
  8648. ------
  8649.  
  8650.      #include <dpmi.h>
  8651.      
  8652.      int __dpmi_simulate_real_mode_interrupt(int _vector, __dpmi_regs *_regs);
  8653.  
  8654. Description
  8655. -----------
  8656.  
  8657. Please refer to *Note DPMI Specification:: for details on DPMI function
  8658. call operation.  Also see *Note DPMI Overview:: for general information.
  8659.  
  8660. DPMI function AX = 0x0300
  8661.  
  8662. This function performs a software interrupt in real mode after filling
  8663. in *all* the registers from the given structure.  You *must* set %ss,
  8664. %esp, and %eflags to valid real-mode values or zero, unlike *Note
  8665. __dpmi_int::.
  8666.  
  8667. Return Value
  8668. ------------
  8669.  
  8670. -1 on error, else zero.
  8671.  
  8672. 
  8673. File: libc,  Node: __dpmi_simulate_real_mode_procedure_iret,  Next: __dpmi_simulate_real_mode_procedure_retf,  Prev: __dpmi_simulate_real_mode_interrupt,  Up: Alphabetical List
  8674.  
  8675. __dpmi_simulate_real_mode_procedure_iret
  8676. ========================================
  8677.  
  8678. Syntax
  8679. ------
  8680.  
  8681.      #include <dpmi.h>
  8682.      
  8683.      int __dpmi_simulate_real_mode_procedure_iret(__dpmi_regs *_regs);
  8684.  
  8685. Description
  8686. -----------
  8687.  
  8688. Please refer to *Note DPMI Specification:: for details on DPMI function
  8689. call operation.  Also see *Note DPMI Overview:: for general information.
  8690.  
  8691. DPMI function AX = 0x0303
  8692.  
  8693. This function switches to real mode, filling in *all* the registers
  8694. from the structure.  ss:sp and flags must be valid or zero.  The called
  8695. function must return with an `iret'.
  8696.  
  8697. Return Value
  8698. ------------
  8699.  
  8700. -1 on error, else zero.
  8701.  
  8702. 
  8703. File: libc,  Node: __dpmi_simulate_real_mode_procedure_retf,  Next: __dpmi_simulate_real_mode_procedure_retf_stack,  Prev: __dpmi_simulate_real_mode_procedure_iret,  Up: Alphabetical List
  8704.  
  8705. __dpmi_simulate_real_mode_procedure_retf
  8706. ========================================
  8707.  
  8708. Syntax
  8709. ------
  8710.  
  8711.      #include <dpmi.h>
  8712.      
  8713.      int __dpmi_simulate_real_mode_procedure_retf(__dpmi_regs *_regs);
  8714.  
  8715. Description
  8716. -----------
  8717.  
  8718. Please refer to *Note DPMI Specification:: for details on DPMI function
  8719. call operation.  Also see *Note DPMI Overview:: for general information.
  8720.  
  8721. DPMI function AX = 0x0301
  8722.  
  8723. This function switches to real mode with *all* the registers set from
  8724. the structure, including cs:ip.  The function called should return with
  8725. a `retf'.  ss:sp and flags must be set to valid values or zero.
  8726.  
  8727. Return Value
  8728. ------------
  8729.  
  8730. -1 on error, else zero.
  8731.  
  8732. 
  8733. File: libc,  Node: __dpmi_simulate_real_mode_procedure_retf_stack,  Next: __dpmi_terminate_and_stay_resident,  Prev: __dpmi_simulate_real_mode_procedure_retf,  Up: Alphabetical List
  8734.  
  8735. __dpmi_simulate_real_mode_procedure_retf_stack
  8736. ==============================================
  8737.  
  8738. Syntax
  8739. ------
  8740.  
  8741.      #include <dpmi.h>
  8742.      
  8743.      int    __dpmi_simulate_real_mode_procedure_retf_stack(__dpmi_regs *_regs, int stack_bytes_to_copy, const void *stack_bytes);
  8744.  
  8745. Description
  8746. -----------
  8747.  
  8748. Please refer to *Note DPMI Specification:: for details on DPMI function
  8749. call operation.  Also see *Note DPMI Overview:: for general information.
  8750.  
  8751. DPMI function AX = 0x0301
  8752.  
  8753. This function switches to real mode with *all* the registers set from
  8754. the structure, including cs:ip.  The function called should return with
  8755. a `retf'.  ss:sp and flags must be set to valid values or zero.
  8756.  
  8757. You may optionally specify bytes to be copied to the real mode stack,
  8758. to pass arguments to real-mode procedures with stack-based calling
  8759. conventions.  If you don't want to copy bytes to the real mode stack,
  8760. pass 0 for stack_bytes_to_copy, and NULL for stack_bytes.
  8761.  
  8762. Return Value
  8763. ------------
  8764.  
  8765. -1 on error, else zero.
  8766.  
  8767. 
  8768. File: libc,  Node: __dpmi_terminate_and_stay_resident,  Next: __dpmi_unlock_linear_region,  Prev: __dpmi_simulate_real_mode_procedure_retf_stack,  Up: Alphabetical List
  8769.  
  8770. __dpmi_terminate_and_stay_resident
  8771. ==================================
  8772.  
  8773. Syntax
  8774. ------
  8775.  
  8776.      #include <dpmi.h>
  8777.      
  8778.      int __dpmi_terminate_and_stay_resident(int return_code, int paragraphs_to_keep);
  8779.  
  8780. Description
  8781. -----------
  8782.  
  8783. Please refer to *Note DPMI Specification:: for details on DPMI function
  8784. call operation.  Also see *Note DPMI Overview:: for general information.
  8785.  
  8786. DPMI function AX = 0x0c01 (DPMI 1.0 only)
  8787.  
  8788. See the spec.
  8789.  
  8790. Return Value
  8791. ------------
  8792.  
  8793. This call does not return.
  8794.  
  8795. 
  8796. File: libc,  Node: __dpmi_unlock_linear_region,  Next: __dpmi_yield,  Prev: __dpmi_terminate_and_stay_resident,  Up: Alphabetical List
  8797.  
  8798. __dpmi_unlock_linear_region
  8799. ===========================
  8800.  
  8801. Syntax
  8802. ------
  8803.  
  8804.      #include <dpmi.h>
  8805.      
  8806.      int __dpmi_unlock_linear_region(__dpmi_meminfo *_info);
  8807.  
  8808. Description
  8809. -----------
  8810.  
  8811. Please refer to *Note DPMI Specification:: for details on DPMI function
  8812. call operation.  Also see *Note DPMI Overview:: for general information.
  8813.  
  8814. DPMI function AX = 0x0601
  8815.  
  8816. This function unlocks virtual memory.  Pass address and size (in bytes).
  8817.  
  8818. Return Value
  8819. ------------
  8820.  
  8821. -1 on error, else zero.
  8822.  
  8823. 
  8824. File: libc,  Node: __dpmi_yield,  Next: dup,  Prev: __dpmi_unlock_linear_region,  Up: Alphabetical List
  8825.  
  8826. __dpmi_yield
  8827. ============
  8828.  
  8829. Syntax
  8830. ------
  8831.  
  8832.      #include <dpmi.h>
  8833.      
  8834.      int __dpmi_yield(void);
  8835.  
  8836. Description
  8837. -----------
  8838.  
  8839. Please refer to *Note DPMI Specification:: for details on DPMI function
  8840. call operation.  Also see *Note DPMI Overview:: for general information.
  8841.  
  8842. INT 0x2f, AX = 0x1680
  8843.  
  8844. This function yields the CPU to the next process.  This should be
  8845. called in busy-wait loops.
  8846.  
  8847. Return Value
  8848. ------------
  8849.  
  8850. None.
  8851.  
  8852. 
  8853. File: libc,  Node: dup,  Next: dup2,  Prev: __dpmi_yield,  Up: Alphabetical List
  8854.  
  8855. dup
  8856. ===
  8857.  
  8858. Syntax
  8859. ------
  8860.  
  8861.      #include <unistd.h>
  8862.      
  8863.      int dup(int old_handle);
  8864.  
  8865. Description
  8866. -----------
  8867.  
  8868. This function duplicates the given file handle.  Both handles refer to
  8869. the same file and file pointer.
  8870.  
  8871. Return Value
  8872. ------------
  8873.  
  8874. The new file handle, or -1 if error.
  8875.  
  8876. Example
  8877. -------
  8878.  
  8879.      do_file(dup(fileno(stdin)));
  8880.  
  8881. 
  8882. File: libc,  Node: dup2,  Next: _dxe_load,  Prev: dup,  Up: Alphabetical List
  8883.  
  8884. dup2
  8885. ====
  8886.  
  8887. Syntax
  8888. ------
  8889.  
  8890.      #include <unistd.h>
  8891.      
  8892.      int dup2(int existing_handle, int new_handle);
  8893.  
  8894. Description
  8895. -----------
  8896.  
  8897. This call causes NEW_HANDLE to refer to the same file and file pointer
  8898. as EXISTING_HANDLE.  If NEW_HANDLE is an open file, it is closed.
  8899.  
  8900. Return Value
  8901. ------------
  8902.  
  8903. The new handle, or -1 on error.
  8904.  
  8905. Example
  8906. -------
  8907.  
  8908.      /* copy new file to stdin stream */
  8909.      close(0);
  8910.      dup2(new_stdin, 0);
  8911.      close(new_stdin);
  8912.  
  8913. 
  8914. File: libc,  Node: _dxe_load,  Next: enable,  Prev: dup2,  Up: Alphabetical List
  8915.  
  8916. _dxe_load
  8917. =========
  8918.  
  8919. Syntax
  8920. ------
  8921.  
  8922.      #include <sys/dxe.h>
  8923.      
  8924.      void *_dxe_load(char *dxe_filename);
  8925.      
  8926.        static int (*add)(int a, int b);
  8927.      
  8928.        add = _dxe_load("add.dxe");
  8929.        if (add == 0)
  8930.          printf("Cannot load add.dxe\n");
  8931.        else
  8932.          printf("Okay, 3 + 4 = %d\n", add(3,4));
  8933.  
  8934. Description
  8935. -----------
  8936.  
  8937. This function loads a dynamic executable image into memory and returns
  8938. the entry point for the symbol associated with the image.  The symbol
  8939. may point to a structure or a function.
  8940.  
  8941. Return Value
  8942. ------------
  8943.  
  8944. 0 on failure, the address of the loaded symbol on success.
  8945.  
  8946. 
  8947. File: libc,  Node: enable,  Next: endgrent,  Prev: _dxe_load,  Up: Alphabetical List
  8948.  
  8949. enable
  8950. ======
  8951.  
  8952. Syntax
  8953. ------
  8954.  
  8955.      #include <dos.h>
  8956.      
  8957.      int enable(void);
  8958.  
  8959. Description
  8960. -----------
  8961.  
  8962. This function enables interrupts.
  8963.  
  8964. *Note disable::.
  8965.  
  8966. Return Value
  8967. ------------
  8968.  
  8969. Returns nonzero if the interrupts were already enabled, zero if they
  8970. had been disabled before this call.
  8971.  
  8972. Example
  8973. -------
  8974.  
  8975.      int ints_were_enabled;
  8976.      
  8977.      ints_were_enabled = enable();
  8978.      . . . do some stuff . . .
  8979.      if (!ints_were_enabled)
  8980.        disable();
  8981.  
  8982. 
  8983. File: libc,  Node: endgrent,  Next: endmntent,  Prev: enable,  Up: Alphabetical List
  8984.  
  8985. endgrent
  8986. ========
  8987.  
  8988. Syntax
  8989. ------
  8990.  
  8991.      #include <grp.h>
  8992.      
  8993.      void endgrent(void);
  8994.  
  8995. Description
  8996. -----------
  8997.  
  8998. This function should be called after all calls to `getgrent',
  8999. `getgrgid', or `getgrnam'.
  9000.  
  9001. Return Value
  9002. ------------
  9003.  
  9004. None.
  9005.  
  9006. Example
  9007. -------
  9008.  
  9009. *Note getgrent::.
  9010.  
  9011. 
  9012. File: libc,  Node: endmntent,  Next: endpwent,  Prev: endgrent,  Up: Alphabetical List
  9013.  
  9014. endmntent
  9015. =========
  9016.  
  9017. Syntax
  9018. ------
  9019.  
  9020.      #include <mntent.h>
  9021.      
  9022.      int endmntent(FILE *filep);
  9023.  
  9024. Description
  9025. -----------
  9026.  
  9027. This function should be called after the last call to getmntent (*note
  9028. getmntent::.).
  9029.  
  9030. Return Value
  9031. ------------
  9032.  
  9033. This function always returns one.
  9034.  
  9035. 
  9036. File: libc,  Node: endpwent,  Next: errno,  Prev: endmntent,  Up: Alphabetical List
  9037.  
  9038. endpwent
  9039. ========
  9040.  
  9041. Syntax
  9042. ------
  9043.  
  9044.      #include <pwd.h>
  9045.      
  9046.      void endpwent(void);
  9047.  
  9048. Description
  9049. -----------
  9050.  
  9051. This function should be called after the last call to getpwent (*note
  9052. getpwent::.).
  9053.  
  9054. Return Value
  9055. ------------
  9056.  
  9057. None.
  9058.  
  9059. 
  9060. File: libc,  Node: errno,  Next: exec*,  Prev: endpwent,  Up: Alphabetical List
  9061.  
  9062. errno
  9063. =====
  9064.  
  9065. Syntax
  9066. ------
  9067.  
  9068.      #include <errno.h>
  9069.      
  9070.      extern int errno;
  9071.  
  9072. Description
  9073. -----------
  9074.  
  9075. This variable is used to hold the value of the error of the last
  9076. function call.  The value might be one of the following:
  9077.  
  9078. `0'
  9079.      No Error
  9080.  
  9081. `1'
  9082.      EDOM - Input to function out of range
  9083.  
  9084. `2'
  9085.      ERANGE - Output of function out of range
  9086.  
  9087. `3'
  9088.      E2BIG - Argument list too long
  9089.  
  9090. `4'
  9091.      EACCES - Permission denied
  9092.  
  9093. `5'
  9094.      EAGAIN - Resource temporarily unavailable
  9095.  
  9096. `6'
  9097.      EBADF - Bad file descriptor
  9098.  
  9099. `7'
  9100.      EBUSY - Resource busy
  9101.  
  9102. `8'
  9103.      ECHILD - No child processes
  9104.  
  9105. `9'
  9106.      EDEADLK - Resource deadlock avoided
  9107.  
  9108. `10'
  9109.      EEXIST - File exists
  9110.  
  9111. `11'
  9112.      EFAULT - Bad address
  9113.  
  9114. `12'
  9115.      EFBIG - File too large
  9116.  
  9117. `13'
  9118.      EINTR - Interrupted system call
  9119.  
  9120. `14'
  9121.      EINVAL - Invalid argument
  9122.  
  9123. `15'
  9124.      EIO - Input or output
  9125.  
  9126. `16'
  9127.      EISDIR - Is a directory
  9128.  
  9129. `17'
  9130.      EMFILE - Too many open files
  9131.  
  9132. `18'
  9133.      EMLINK - Too many links
  9134.  
  9135. `19'
  9136.      ENAMETOOLONG - File name too long
  9137.  
  9138. `20'
  9139.      ENFILE - Too many open files in system
  9140.  
  9141. `21'
  9142.      ENODEV - No such device
  9143.  
  9144. `22'
  9145.      ENOENT - No such file or directory
  9146.  
  9147. `23'
  9148.      ENOEXEC - Unable to execute file
  9149.  
  9150. `24'
  9151.      ENOLCK - No locks available
  9152.  
  9153. `25'
  9154.      ENOMEM - Not enough memory
  9155.  
  9156. `26'
  9157.      ENOSPC - No space left on drive
  9158.  
  9159. `27'
  9160.      ENOSYS - Function not implemented
  9161.  
  9162. `28'
  9163.      ENOTDIR - Not a directory
  9164.  
  9165. `29'
  9166.      ENOTEMPTY - Directory not empty
  9167.  
  9168. `30'
  9169.      ENOTTY - Inappropriate I/O control operation
  9170.  
  9171. `31'
  9172.      ENXIO - No such device or address
  9173.  
  9174. `32'
  9175.      EPERM - Operation not permitted
  9176.  
  9177. `33'
  9178.      EPIPE - Broken pipe
  9179.  
  9180. `34'
  9181.      EROFS - Read-only file system
  9182.  
  9183. `35'
  9184.      ESPIPE - Invalid seek
  9185.  
  9186. `36'
  9187.      ESRCH - No such process
  9188.  
  9189. `37'
  9190.      EXDEV - Improper link
  9191.  
  9192. `38'
  9193.      ENMFILE - No more files
  9194.  
  9195. *Note perror::.
  9196.  
  9197. 
  9198. File: libc,  Node: exec*,  Next: _exit,  Prev: errno,  Up: Alphabetical List
  9199.  
  9200. exec*
  9201. =====
  9202.  
  9203. Syntax
  9204. ------
  9205.  
  9206.      #include <unistd.h>
  9207.      
  9208.      int execl(const char *path, const char *argv0, ...);
  9209.      int execle(const char *path, const char *argv0, ... /*, char *const envp[] */);
  9210.      int execlp(const char *path, const char *argv0, ...);
  9211.      int execlpe(const char *path, const char *argv0, ... /*, char *const envp[] */);
  9212.      
  9213.      int execv(const char *path, char *const argv[]);
  9214.      int execve(const char *path, char *const argv[], char *const envp[]);
  9215.      int execvp(const char *path, char *const argv[]);
  9216.      int execvpe(const char *path, char *const argv[], char *const envp[]);
  9217.  
  9218. Description
  9219. -----------
  9220.  
  9221. These functions operate by calling `spawn*' with a type of `P_OVERLAY'.
  9222. Refer to *Note spawn*:: for a full description.
  9223.  
  9224. Return Value
  9225. ------------
  9226.  
  9227. If successful, these functions do not return.  If there is an error,
  9228. these functions return -1 and set `errno' to indicate the error.
  9229.  
  9230. Example
  9231. -------
  9232.  
  9233.      execlp("gcc", "gcc", "-v", "hello.c", 0);
  9234.  
  9235. 
  9236. File: libc,  Node: _exit,  Next: exit,  Prev: exec*,  Up: Alphabetical List
  9237.  
  9238. _exit
  9239. =====
  9240.  
  9241. Syntax
  9242. ------
  9243.  
  9244.      #include <stdlib.h>
  9245.      
  9246.      void _exit(int exit_code);
  9247.  
  9248. Description
  9249. -----------
  9250.  
  9251. This function exits the program, returning EXIT_CODE to the calling
  9252. process.  No additional processing is done, and any `atexit' functions
  9253. are not called.  This function is normally called only by `exit'.
  9254. Since this does not unhook hardware interrupts, this can cause crashes
  9255. after the program exits.
  9256.  
  9257. Return Value
  9258. ------------
  9259.  
  9260. This function does not return.
  9261.  
  9262. 
  9263. File: libc,  Node: exit,  Next: exp,  Prev: _exit,  Up: Alphabetical List
  9264.  
  9265. exit
  9266. ====
  9267.  
  9268. Syntax
  9269. ------
  9270.  
  9271.      #include <stdlib.h>
  9272.      
  9273.      void exit(int exit_code);
  9274.  
  9275. Description
  9276. -----------
  9277.  
  9278. This function exits the program, returning EXIT_CODE to the calling
  9279. process.  Before exiting, all open files are closed and all `atexit'
  9280. and `on_exit' requests are processed.
  9281.  
  9282. Return Value
  9283. ------------
  9284.  
  9285. This function does not return.
  9286.  
  9287. Example
  9288. -------
  9289.  
  9290.      if (argc < 4)
  9291.      {
  9292.        print_usage();
  9293.        exit(1);
  9294.      }
  9295.  
  9296. 
  9297. File: libc,  Node: exp,  Next: fabs,  Prev: exit,  Up: Alphabetical List
  9298.  
  9299. exp
  9300. ===
  9301.  
  9302. Syntax
  9303. ------
  9304.  
  9305.      #include <math.h>
  9306.      
  9307.      double exp(double x);
  9308.  
  9309. Return Value
  9310. ------------
  9311.  
  9312. e to the X power.
  9313.  
  9314. 
  9315. File: libc,  Node: fabs,  Next: _far*,  Prev: exp,  Up: Alphabetical List
  9316.  
  9317. fabs
  9318. ====
  9319.  
  9320. Syntax
  9321. ------
  9322.  
  9323.      #include <math.h>
  9324.      
  9325.      double fabs(double x);
  9326.  
  9327. Return Value
  9328. ------------
  9329.  
  9330. X if X is positive, else -X.  Note that in this context, +0.0 is
  9331. positive and -0.0 is negative.
  9332.  
  9333. 
  9334. File: libc,  Node: _far*,  Next: fclose,  Prev: fabs,  Up: Alphabetical List
  9335.  
  9336. _far*
  9337. =====
  9338.  
  9339. Syntax
  9340. ------
  9341.  
  9342.      #include <sys/farptr.h>
  9343.      
  9344.      unsigned char _farpeekb(unsigned short selector, unsigned long offset);
  9345.      unsigned short _farpeekw(unsigned short selector, unsigned long offset);
  9346.      unsigned long _farpeekl(unsigned short selector, unsigned long offset);
  9347.      
  9348.      void _farpokeb(unsigned short sel, unsigned long off, unsigned char val);
  9349.      void _farpokew(unsigned short sel, unsigned long off, unsigned short val);
  9350.      void _farpokel(unsigned short sel, unsigned long off, unsigned long val);
  9351.      
  9352.      void _farsetsel(unsigned short selector);
  9353.      
  9354.      void _farnspokeb(unsigned long offset, unsigned char value);
  9355.      void _farnspokew(unsigned long offset, unsigned short value);
  9356.      void _farnspokel(unsigned long offset, unsigned long value);
  9357.      
  9358.      unsigned char _farnspeekb(unsigned long offset);
  9359.      unsigned short _farnspeekw(unsigned long offset);
  9360.      unsigned long _farnspeekl(unsigned long offset);
  9361.  
  9362. Description
  9363. -----------
  9364.  
  9365. These functions provide the equivalent functionality of "far pointers"
  9366. to peek or poke an absolute memory addresses, even though gcc doesn't
  9367. understand the keyword "far".  They come in handy when you need to
  9368. access memory-mapped devices (like VGA) or some address in lower memory
  9369. returned by a real-mode service.  These functions are provided as
  9370. inline assembler functions, so when you optimize your program they
  9371. reduce to only a few opcodes (only one more than a regular memory
  9372. access), resulting in very optimal code.
  9373.  
  9374. The first two groups of functions take a SELECTOR and an OFFSET.  This
  9375. selector is *not* a dos segment.  If you want to access dos memory,
  9376. pass _go32_info_block.selector_for_linear_memory (or just _dos_ds) as
  9377. the selector, and seg*16+ofs as the offset.  For functions which poke
  9378. the memory, you should also provide the VALUE to put there.
  9379.  
  9380. The last two groups assume that you've used `_farsetsel' to specify the
  9381. selector.  You should avoid making any function calls between
  9382. `_farsetsel' and using these other functions, unless you're absolutely
  9383. sure that they won't modify that selector.  This allows you to optimize
  9384. loops by setting the selector once outside the loop, and using the
  9385. shorter functions within the loop.
  9386.  
  9387. Return Value
  9388. ------------
  9389.  
  9390. Functions which peek the address return the value at given address.
  9391.  
  9392. 
  9393. File: libc,  Node: fclose,  Next: fcntl,  Prev: _far*,  Up: Alphabetical List
  9394.  
  9395. fclose
  9396. ======
  9397.  
  9398. Syntax
  9399. ------
  9400.  
  9401.      #include <stdio.h>
  9402.      
  9403.      int fclose(FILE *file);
  9404.  
  9405. Description
  9406. -----------
  9407.  
  9408. This function closes the given FILE.
  9409.  
  9410. Return Value
  9411. ------------
  9412.  
  9413. Zero on success, else `EOF'.
  9414.  
  9415. Example
  9416. -------
  9417.  
  9418.      FILE *f = fopen("data", "r");
  9419.      fprintf(f, "Hello\n");
  9420.      fclose(f);
  9421.  
  9422. 
  9423. File: libc,  Node: fcntl,  Next: fdopen,  Prev: fclose,  Up: Alphabetical List
  9424.  
  9425. fcntl
  9426. =====
  9427.  
  9428. Syntax
  9429. ------
  9430.  
  9431.      #include <fcntl.h>
  9432.      
  9433.      int fcntl(int fd, int cmd, ...);
  9434.  
  9435. Description
  9436. -----------
  9437.  
  9438. This function   currently only  supports CMD  of `F_DUPFD', which acts
  9439. like `dup(fd)' (*note dup::.).
  9440.  
  9441. Return Value
  9442. ------------
  9443.  
  9444. Varies.
  9445.  
  9446. 
  9447. File: libc,  Node: fdopen,  Next: feof,  Prev: fcntl,  Up: Alphabetical List
  9448.  
  9449. fdopen
  9450. ======
  9451.  
  9452. Syntax
  9453. ------
  9454.  
  9455.      #include <stdio.h>
  9456.      
  9457.      FILE *fdopen(int fd, const char *mode);
  9458.  
  9459. Description
  9460. -----------
  9461.  
  9462. This function opens a stream-type file that uses the given FD file,
  9463. which must already be open.  The file is opened with the modes
  9464. specified by MODE, which is the same as for `fopen'.  *Note fopen::.
  9465.  
  9466. Return Value
  9467. ------------
  9468.  
  9469. The newly created `FILE *', or `NULL' on error.
  9470.  
  9471. Example
  9472. -------
  9473.  
  9474.      FILE *stdprn = fdopen(4, "w");
  9475.  
  9476. 
  9477. File: libc,  Node: feof,  Next: ferror,  Prev: fdopen,  Up: Alphabetical List
  9478.  
  9479. feof
  9480. ====
  9481.  
  9482. Syntax
  9483. ------
  9484.  
  9485.      #include <stdio.h>
  9486.      
  9487.      int feof(FILE *file);
  9488.  
  9489. Description
  9490. -----------
  9491.  
  9492. This function can be used to indicate if the given FILE is at the
  9493. end-of-file or not.
  9494.  
  9495. Return Value
  9496. ------------
  9497.  
  9498. Nonzero at end-of-file, zero otherwise.
  9499.  
  9500. Example
  9501. -------
  9502.  
  9503.      while (!feof(stdin))
  9504.        gets(line);
  9505.  
  9506. 
  9507. File: libc,  Node: ferror,  Next: fflush,  Prev: feof,  Up: Alphabetical List
  9508.  
  9509. ferror
  9510. ======
  9511.  
  9512. Syntax
  9513. ------
  9514.  
  9515.      #include <stdio.h>
  9516.      
  9517.      int ferror(FILE *file);
  9518.  
  9519. Description
  9520. -----------
  9521.  
  9522. This function can be used to indicate if the given FILE has encountered
  9523. an error or not.  *Note clearerr::.
  9524.  
  9525. Return Value
  9526. ------------
  9527.  
  9528. Nonzero for an error, zero otherwize.
  9529.  
  9530. Example
  9531. -------
  9532.  
  9533.      if (ferror(stdin))
  9534.        exit(1);
  9535.  
  9536. 
  9537. File: libc,  Node: fflush,  Next: ffs,  Prev: ferror,  Up: Alphabetical List
  9538.  
  9539. fflush
  9540. ======
  9541.  
  9542. Syntax
  9543. ------
  9544.  
  9545.      #include <stdio.h>
  9546.      
  9547.      int fflush(FILE *file);
  9548.  
  9549. Description
  9550. -----------
  9551.  
  9552. This function causes any unwritten buffered data to be written out to
  9553. the given FILE.  This is useful in cases where the output is line
  9554. buffered and you want to write a partial line.
  9555.  
  9556. Return Value
  9557. ------------
  9558.  
  9559. Zero on success, -1 on error.
  9560.  
  9561. Example
  9562. -------
  9563.  
  9564.      printf("Enter value : ");
  9565.      fflush(stdout);
  9566.      scanf(result);
  9567.  
  9568. 
  9569. File: libc,  Node: ffs,  Next: fgetc,  Prev: fflush,  Up: Alphabetical List
  9570.  
  9571. ffs
  9572. ===
  9573.  
  9574. Syntax
  9575. ------
  9576.  
  9577.      #include <string.h>
  9578.      
  9579.      int ffs(int _mask);
  9580.  
  9581. Description
  9582. -----------
  9583.  
  9584. This function find the first (least significant) bit set in the input
  9585. value.
  9586.  
  9587. Return Value
  9588. ------------
  9589.  
  9590. Bit position (1..32) of the least significant set bit, or zero if the
  9591. input value is zero.
  9592.  
  9593. Example
  9594. -------
  9595.  
  9596.      ffs(0) = 0
  9597.      ffs(1) = 1
  9598.      ffs(5) = 1
  9599.      ffs(96) = 6
  9600.  
  9601. 
  9602. File: libc,  Node: fgetc,  Next: fgetgrent,  Prev: ffs,  Up: Alphabetical List
  9603.  
  9604. fgetc
  9605. =====
  9606.  
  9607. Syntax
  9608. ------
  9609.  
  9610.      #include <stdio.h>
  9611.      
  9612.      int fgetc(FILE *file);
  9613.  
  9614. Description
  9615. -----------
  9616.  
  9617. Returns the next character in the given FILE as an unsigned char.
  9618.  
  9619. Return Value
  9620. ------------
  9621.  
  9622. The given char (value 0..255) or `EOF' at end-of-file.
  9623.  
  9624. Example
  9625. -------
  9626.  
  9627.      int c;
  9628.      while((c=fgetc(stdin)) != EOF)
  9629.        fputc(c, stdout);
  9630.  
  9631. 
  9632. File: libc,  Node: fgetgrent,  Next: fgetpos,  Prev: fgetc,  Up: Alphabetical List
  9633.  
  9634. fgetgrent
  9635. =========
  9636.  
  9637. Syntax
  9638. ------
  9639.  
  9640.      #include <grp.h>
  9641.      
  9642.      struct group *fgetgrent(FILE *file);
  9643.  
  9644. Description
  9645. -----------
  9646.  
  9647. This function, in MS-DOS, is exactly the same as `getgrent' (*note
  9648. getgrent::.).
  9649.  
  9650. 
  9651. File: libc,  Node: fgetpos,  Next: fgets,  Prev: fgetgrent,  Up: Alphabetical List
  9652.  
  9653. fgetpos
  9654. =======
  9655.  
  9656. Syntax
  9657. ------
  9658.  
  9659.      #include <stdio.h>
  9660.      
  9661.      int fgetpos(FILE *file, fpos_t *offset);
  9662.  
  9663. Description
  9664. -----------
  9665.  
  9666. This function records the current file pointer for FILE, for later use
  9667. by `fsetpos'.
  9668.  
  9669. *Note fsetpos::.  *Note ftell::.
  9670.  
  9671. Return Value
  9672. ------------
  9673.  
  9674. Zero if successful, nonzero if not.
  9675.  
  9676. 
  9677. File: libc,  Node: fgets,  Next: File System Extensions,  Prev: fgetpos,  Up: Alphabetical List
  9678.  
  9679. fgets
  9680. =====
  9681.  
  9682. Syntax
  9683. ------
  9684.  
  9685.      #include <stdio.h>
  9686.      
  9687.      char *fgets(char *buffer, int maxlength, FILE *file);
  9688.  
  9689. Description
  9690. -----------
  9691.  
  9692. This function reads as much of a line from a file as possible, stopping
  9693. when the buffer is full (MAXLENGTH-1 characters), an end-of-line is
  9694. detected, or `EOF' or an error is detected.  It then stores a `NULL' to
  9695. terminate the string.
  9696.  
  9697. Return Value
  9698. ------------
  9699.  
  9700. The address of the buffer is returned on success, if `EOF' is
  9701. encountered before any characters are stored, or if an error is
  9702. detected, `NULL' is returned instead.
  9703.  
  9704. Example
  9705. -------
  9706.  
  9707.      char buf[100];
  9708.      while (fgets(buf, 100, stdin))
  9709.        fputs(buf, stdout);
  9710.  
  9711. 
  9712. File: libc,  Node: File System Extensions,  Next: __file_exists,  Prev: fgets,  Up: Alphabetical List
  9713.  
  9714. File System Extensions
  9715. ======================
  9716.  
  9717. Description
  9718. -----------
  9719.  
  9720. The File System Extensions are a part of the lowest level of I/O
  9721. operations in the C runtime library of DJGPP.  These extensions are
  9722. provided to allow for cases where Unix uses a file descriptor to access
  9723. such items as serial ports, memory, and the network, but DOS does not.
  9724. It allows a set of functions (called an extension) to gain control when
  9725. one of these low-level functions is called on a file descriptor set up
  9726. by the extension.
  9727.  
  9728. Each extension must provide one or two handler functions.  All handler
  9729. functions take the same arguments:
  9730.  
  9731.        int function(__FDEXT_Fnumber func_number, int *rv, va_args *args);
  9732.  
  9733. The FUNC_NUMBER identifies which function is to be emulated.  The file
  9734. `<sys/fsext.h>' lists the function numbers.  RV points to a temporary
  9735. return value pointer.  If the function is emulated, the return value
  9736. should be stored here, and the function should return a nonzero value.
  9737. If the function returns zero, it is assumed to have not emulated the
  9738. call, and the regular DOS I/O function will happen.  The ARGS represent
  9739. the arguments passed to the original function; these point to the
  9740. actual arguments on the stack, so the emulation may choose to modify
  9741. them and return zero to the regular function, which will then act on
  9742. the modified arguments.
  9743.  
  9744. A normal extension would provide these parts:
  9745.  
  9746.    *  Some function to create a connection to the extension.  This may
  9747.      be a custom function (such as `socket' for networking) or an
  9748.      extension to open (such as for `/dev/null' emulation).
  9749.  
  9750.    *  Initialization code that adds the open handler, if any.
  9751.  
  9752.    *  Overrides for the basic I/O functions, such as `read' and
  9753.      `write'.  This is a single function in the extension that uses the
  9754.      function number parameter to select an extension function.
  9755.  
  9756.    *  The core functionality of the extension, if any.
  9757.  
  9758. 
  9759. File: libc,  Node: __file_exists,  Next: file_tree_walk,  Prev: File System Extensions,  Up: Alphabetical List
  9760.  
  9761. __file_exists
  9762. =============
  9763.  
  9764. Syntax
  9765. ------
  9766.  
  9767.      #include <unistd.h>
  9768.      
  9769.      int __file_exists(const char *_fn);
  9770.  
  9771. Description
  9772. -----------
  9773.  
  9774. This function provides a fast way to ask if a given file exists.
  9775. Unlike access(), this function does not cause other objects to get
  9776. linked in with your program, so is used primarily by the startup code
  9777. to keep minimum code size small.
  9778.  
  9779. Return Value
  9780. ------------
  9781.  
  9782. Zero if the file does not exist, nonzero if it does.  Note that this is
  9783. the opposite of what access() returns.
  9784.  
  9785. Example
  9786. -------
  9787.  
  9788.  
  9789.      if (__file_exists(fname))
  9790.        process_file(fname);
  9791.  
  9792. 
  9793. File: libc,  Node: file_tree_walk,  Next: filelength,  Prev: __file_exists,  Up: Alphabetical List
  9794.  
  9795. file_tree_walk
  9796. ==============
  9797.  
  9798. Syntax
  9799. ------
  9800.  
  9801.      #include <dir.h>
  9802.      
  9803.      int __file_tree_walk(const char *dir,
  9804.                         int (*func)(const char *path, const struct ffblk *ff));
  9805.  
  9806. Description
  9807. -----------
  9808.  
  9809. This function recursively descends the directory hierarchy which starts
  9810. with DIR.  For each file in the hierarchy, `__file_tree_walk' calls the
  9811. user-defined function FUNC which is passed a pointer to a
  9812. `NULL'-terminated character array in PATH holding the full pathname of
  9813. the file, a pointer to a `ffblk' structure (*note findfirst::.) FFF
  9814. with a DOS filesystem information about that file.
  9815.  
  9816. This function always visits a directory before any of its siblings.  The
  9817. argument DIR must be a directory, or `__file_tree_walk' will fail and
  9818. set ERRNO to `ENOTDIR'.  The directory DIR itself is never passed to
  9819. FUNC.
  9820.  
  9821. The tree traversal continues until one of the following events:
  9822.  
  9823. (1)  The tree is exhausted (i.e., all descendants of DIR are
  9824. processed).  In this case, `__file_tree_walk' returns 0, meaning a
  9825. success.
  9826.  
  9827. (2)  An invocation of FUNC returns a non-zero value.  In this case,
  9828. `__file_tree_walk' stops the tree traversal and returns whatever FUNC
  9829. returned.
  9830.  
  9831. (3)  An error is detected within `__file_tree_walk'.  In that case,
  9832. `ftw' returns -1 and sets ERRNO (*note errno::.) to a suitable value.
  9833.  
  9834. Return Value
  9835. ------------
  9836.  
  9837. Zero in case the entire tree was successfully traversed, -1 if
  9838. `__file_tree_walk' detected some error during its operation, or any
  9839. other non-zero value which was returned by the user-defined function
  9840. FUNC.
  9841.  
  9842. Example
  9843. -------
  9844.  
  9845.      #include <stdlib.h>
  9846.      
  9847.      int
  9848.      ff_walker(const char *path, const struct ffblk *ff)
  9849.      {
  9850.        printf("%s:\t%lu\t", path, ff->ff_fsize);
  9851.        if (ff->ff_attrib & 1)
  9852.          printf("R");
  9853.        if (ff->ff_attrib & 2)
  9854.          printf("H");
  9855.        if (ff->ff_attrib & 4)
  9856.          printf("S");
  9857.        if (ff->ff_attrib & 8)
  9858.          printf("V");
  9859.        if (ff->ff_attrib & 0x10)
  9860.          printf("D");
  9861.        if (ff->ff_attrib & 0x20)
  9862.          printf("A");
  9863.        printf("\n");
  9864.      
  9865.        if (strcmp(ff->ff_name, "XXXXX") == 0)
  9866.          return 42;
  9867.        return 0;
  9868.      }
  9869.      
  9870.      int
  9871.      main(int argc, char *argv[])
  9872.      {
  9873.        if (argc > 1)
  9874.          {
  9875.            char msg[80];
  9876.      
  9877.            sprintf(msg, "__file_tree_walk: %d",
  9878.                         __file_tree_walk(argv[1], ff_walker));
  9879.            if (errno)
  9880.              perror(msg);
  9881.            else
  9882.              puts(msg);
  9883.          }
  9884.        else
  9885.          printf("Usage: %s dir\n", argv[0]);
  9886.      
  9887.        return 0;
  9888.      }
  9889.  
  9890. 
  9891. File: libc,  Node: filelength,  Next: fileno,  Prev: file_tree_walk,  Up: Alphabetical List
  9892.  
  9893. filelength
  9894. ==========
  9895.  
  9896. Syntax
  9897. ------
  9898.  
  9899.      #include <io.h>
  9900.      
  9901.      long filelength(int fhandle);
  9902.  
  9903. Description
  9904. -----------
  9905.  
  9906. This function returns the size, in bytes, of a file whose handle is
  9907. specified in the argument FHANDLE.  To get the handle of a file opened
  9908. by *Note fopen:: or *Note freopen::, you can use *Note fileno:: macro.
  9909.  
  9910. Return Value
  9911. ------------
  9912.  
  9913. The size of the file in bytes, or (if any error occured) -1L and ERRNO
  9914. set to a value describing the cause of the failure.
  9915.  
  9916. Example
  9917. -------
  9918.  
  9919.        printf("Size of file to which STDIN is redirected is %ld\n",
  9920.                filelength(0));
  9921.  
  9922. 
  9923. File: libc,  Node: fileno,  Next: findfirst,  Prev: filelength,  Up: Alphabetical List
  9924.  
  9925. fileno
  9926. ======
  9927.  
  9928. Syntax
  9929. ------
  9930.  
  9931.      #include <stdio.h>
  9932.      
  9933.      int fileno(FILE *file);
  9934.  
  9935. Description
  9936. -----------
  9937.  
  9938. This function returns the raw file descriptor number that FILE uses for
  9939. I/O.
  9940.  
  9941. Return Value
  9942. ------------
  9943.  
  9944. The file descriptor number.
  9945.  
  9946. 
  9947. File: libc,  Node: findfirst,  Next: findnext,  Prev: fileno,  Up: Alphabetical List
  9948.  
  9949. findfirst
  9950. =========
  9951.  
  9952. Syntax
  9953. ------
  9954.  
  9955.      #include <dir.h>
  9956.      
  9957.      int findfirst(const char *pathname, struct ffblk *ffblk, int attrib);
  9958.  
  9959. Description
  9960. -----------
  9961.  
  9962. This function and the related `findnext' (*note findnext::.) are used
  9963. to scan directories for the list of files therein.  The PATHNAME is a
  9964. wildcard that specifies the directory and files to search for (such as
  9965. `subdir/*.c'), FFBLK is a structure to hold the results and state of
  9966. the search, and ATTRIB is a combination of the following:
  9967.  
  9968. `FA_RDONLY'
  9969.      Include read-only files in the search
  9970.  
  9971. `FA_HIDDEN'
  9972.      Include hidden files in the search
  9973.  
  9974. `FA_SYSTEM'
  9975.      Include system files in the search
  9976.  
  9977. `FA_LABEL'
  9978.      Include the volume label in the search
  9979.  
  9980. `FA_DIREC'
  9981.      Include subdirectories in the search
  9982.  
  9983. `FA_ARCH'
  9984.      Include modified files in the search
  9985.  
  9986. Any file that doesn't have any flag bits that aren't specified is
  9987. selected for the search.  Thus, if you specified `FA_DIREC' and
  9988. `FA_LABEL', you would get all subdirectories, the volume label, and any
  9989. file that is neither read-only or modified.
  9990.  
  9991. The results of the search are stored in FFBLK:
  9992.  
  9993.      struct ffblk {
  9994.        char ff_reserved[21];     /* used to hold the state of the search */
  9995.        unsigned char ff_attrib;  /* actual attributes of the file found */
  9996.        unsigned short ff_ftime;  /* hours:5, minutes:6, (seconds/2):5 */
  9997.        unsigned short ff_fdate;  /* (year-1980):7, month:4, day:5 */
  9998.        unsigned long ff_fsize;   /* size of file */
  9999.        char ff_name[16];         /* name of file as ASCIIZ string */
  10000.      }
  10001.  
  10002. Return Value
  10003. ------------
  10004.  
  10005. Zero if a match is found, nonzero if none found.
  10006.  
  10007. Example
  10008. -------
  10009.  
  10010.      struct ffblk f;
  10011.      int done = findfirst("*.exe", &f, FA_ARCH|FA_RDONLY);
  10012.      while (!done)
  10013.      {
  10014.        printf("%10u %2u:%02u:%02u %2u/%02u/%4u %s\n",
  10015.          f.ff_fsize,
  10016.          (f.ff_ftime >> 11) & 0x1f,
  10017.          (f.ff_ftime >>  5) & 0x3f,
  10018.          (f.ff_ftime & 0x1f) * 2,
  10019.          (f.ff_fdate >>  5) & 0x0f,
  10020.          (f.ff_fdate & 0x1f),
  10021.          ((f.ff_fdate >> 9) & 0x7f) + 1980,
  10022.          f.ff_name);
  10023.        done = findnext(&f);
  10024.      }
  10025.  
  10026. 
  10027. File: libc,  Node: findnext,  Next: _fixpath,  Prev: findfirst,  Up: Alphabetical List
  10028.  
  10029. findnext
  10030. ========
  10031.  
  10032. Syntax
  10033. ------
  10034.  
  10035.      #include <dir.h>
  10036.      
  10037.      int findnext(struct ffblk *ffblk);
  10038.  
  10039. Description
  10040. -----------
  10041.  
  10042. This finds the next file in the search started by `findfirst'.  *Note
  10043. findfirst::.
  10044.  
  10045. Return Value
  10046. ------------
  10047.  
  10048. Zero if there was a match, else nonzero.
  10049.  
  10050. 
  10051. File: libc,  Node: _fixpath,  Next: floor,  Prev: findnext,  Up: Alphabetical List
  10052.  
  10053. _fixpath
  10054. ========
  10055.  
  10056. Syntax
  10057. ------
  10058.  
  10059.      #include <sys/stat.h>
  10060.      
  10061.      void _fixpath(const char *in_path, char *out_path);
  10062.  
  10063. Description
  10064. -----------
  10065.  
  10066. This function canonacalizes the input path IN_PATH and stores the
  10067. result in the buffer pointed to by OUT_PATH.
  10068.  
  10069. The path is fixed by removing consecutive and trailing slashes, making
  10070. the path absolute if it's relative, removing "." components, collapsing
  10071. ".." components, adding a drive specifier if needed, and converting all
  10072. slashes to '/'.
  10073.  
  10074. Return Value
  10075. ------------
  10076.  
  10077. None.
  10078.  
  10079. Example
  10080. -------
  10081.  
  10082.      char oldpath[100], newpath[100];
  10083.      scanf(oldpath);
  10084.      _fixpath(oldpath, newpath);
  10085.      printf("that really is %s\n", newpath);
  10086.  
  10087. 
  10088. File: libc,  Node: floor,  Next: fmod,  Prev: _fixpath,  Up: Alphabetical List
  10089.  
  10090. floor
  10091. =====
  10092.  
  10093. Syntax
  10094. ------
  10095.  
  10096.      #include <math.h>
  10097.      
  10098.      double floor(double x);
  10099.  
  10100. Return Value
  10101. ------------
  10102.  
  10103. The largest integer value less than or equal to X.
  10104.  
  10105. 
  10106. File: libc,  Node: fmod,  Next: _fmode,  Prev: floor,  Up: Alphabetical List
  10107.  
  10108. fmod
  10109. ====
  10110.  
  10111. Syntax
  10112. ------
  10113.  
  10114.      #include <math.h>
  10115.      
  10116.      double fmod(double x, double y);
  10117.  
  10118. Return Value
  10119. ------------
  10120.  
  10121. The remainder of X/Y.
  10122.  
  10123. 
  10124. File: libc,  Node: _fmode,  Next: fnmatch,  Prev: fmod,  Up: Alphabetical List
  10125.  
  10126. _fmode
  10127. ======
  10128.  
  10129. Syntax
  10130. ------
  10131.  
  10132.      #include <fcntl.h>
  10133.      
  10134.      extern int _fmode;
  10135.  
  10136. Description
  10137. -----------
  10138.  
  10139. This variable may be set to `O_TEXT' or `O_BINARY' to specify the mode
  10140. that newly opened files should be opened in if the open call did not
  10141. specify.  *Note open::. *Note fopen::.
  10142.  
  10143. The default value is `O_TEXT'.
  10144.  
  10145. Example
  10146. -------
  10147.  
  10148.      _fmode = O_BINARY;
  10149.  
  10150. 
  10151. File: libc,  Node: fnmatch,  Next: fnmerge,  Prev: _fmode,  Up: Alphabetical List
  10152.  
  10153. fnmatch
  10154. =======
  10155.  
  10156. Syntax
  10157. ------
  10158.  
  10159.      #include <fnmatch.h>
  10160.      
  10161.      int fnmatch(const char *pattern, const char *string, int flags);
  10162.  
  10163. Description
  10164. -----------
  10165.  
  10166. This function indicates if STRING matches the PATTERN.  The pattern may
  10167. include the following special characters:
  10168.  
  10169. `*'
  10170.      Matches zero of more characters.
  10171.  
  10172. `?'
  10173.      Matches exactly one character
  10174.  
  10175. `[...]'
  10176.      Matches one character if it's in a range of characters.  If the
  10177.      first character is `!', matches if the character is not in the
  10178.      range.  Between the brackets, the range is specified by listing
  10179.      the characters that are in the range, or two characters separated
  10180.      by `-' to indicate all characters in that range.  For example,
  10181.      `[a-d]' matches `a', `b', `c', or `d'.
  10182.  
  10183. `\'
  10184.      Causes the next character to not be treated as a wildcard.  For
  10185.      example, `\*' matches an asterisk.  This is only available if FLAGS
  10186.      includes `FNM_QUOTE'.
  10187.  
  10188. The value of FLAGS is a combination of zero of more of the following:
  10189.  
  10190. `FNM_PATHNAME'
  10191.      This means that the string should be treated as a pathname, in
  10192.      that the slash character `/' never matches any of the wildcards.
  10193.  
  10194. `FNM_QUOTE'
  10195.      This means that the backslash `\\' may be used for quoting special
  10196.      characters in the pattern.
  10197.  
  10198. Return Value
  10199. ------------
  10200.  
  10201. Zero if the string matches, FNM_NOMATCH if it does not.
  10202.  
  10203. Example
  10204. -------
  10205.  
  10206.      if (fnmatch("*.[ch]", filename, FNM_PATH|FNM_QUOTE))
  10207.        do_source_file(filename);
  10208.  
  10209. 
  10210. File: libc,  Node: fnmerge,  Next: fnsplit,  Prev: fnmatch,  Up: Alphabetical List
  10211.  
  10212. fnmerge
  10213. =======
  10214.  
  10215. Syntax
  10216. ------
  10217.  
  10218.      #include <dir.h>
  10219.      
  10220.      void fnmerge (char *path, const char *drive, const char *dir,
  10221.              const char *name, const char *ext);
  10222.  
  10223. Description
  10224. -----------
  10225.  
  10226. This function constructs a file PATH from its components DRIVE, DIR,
  10227. NAME, and EXT.  If any of these is a `NULL' pointer, it won't be used.
  10228. Usually, the DRIVE string should include the trailing colon ``:'', the
  10229. DIR string should include the trailing slash ``/'' or backslash ``\'',
  10230. and the EXT string should include the leading dot ``.''.  However, if
  10231. any of these isn't present, `fnmerge' will add them.
  10232.  
  10233. *Note fnsplit::.
  10234.  
  10235. Return Value
  10236. ------------
  10237.  
  10238. None.
  10239.  
  10240. Example
  10241. -------
  10242.  
  10243.      char buf[MAXPATH];
  10244.      fnmerge(buf, "d:", "/foo/", "data", ".txt");
  10245.  
  10246. 
  10247. File: libc,  Node: fnsplit,  Next: fopen,  Prev: fnmerge,  Up: Alphabetical List
  10248.  
  10249. fnsplit
  10250. =======
  10251.  
  10252. Syntax
  10253. ------
  10254.  
  10255.      #include <dir.h>
  10256.      
  10257.      int fnsplit (const char *path, char *drive, char *dir,
  10258.              char *name, char *ext);
  10259.  
  10260. Description
  10261. -----------
  10262.  
  10263. This function decomposes a PATH into its components.  It is smart
  10264. enough to know that `.' and `..' are directories.  The DRIVE, DIR, NAME
  10265. and EXT arguments should all be passed, but some or even all of them
  10266. might be `NULL' pointers.  Those of them which are non-`NULL' should
  10267. point to buffers which have enough room for the strings they would
  10268. hold.  The constants `MAXDRIVE', `MAXDIR', `MAXFILE' and `MAXEXT',
  10269. defined on dir.h, define the maximum length of these buffers.
  10270.  
  10271. *Note fnmerge::.
  10272.  
  10273. Return Value
  10274. ------------
  10275.  
  10276. A flag that indicates which components were found:
  10277.  
  10278. `DRIVE'
  10279.      The drive letter was found.
  10280.  
  10281. `DIRECTORY'
  10282.      A directory or subdirectories was found.
  10283.  
  10284. `FILENAME'
  10285.      A filename was found.
  10286.  
  10287. `EXTENSION'
  10288.      An extension was found.
  10289.  
  10290. `WILDCARDS'
  10291.      The path included `*' or `?'.
  10292.  
  10293. Example
  10294. -------
  10295.  
  10296.      char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT];
  10297.      int which = fnsplit("d:/djgpp/bin/gcc.exe", d, p, f, e);
  10298.      d = "d:"
  10299.      p = "/djgpp/bin/"
  10300.      f = "gcc"
  10301.      e = ".exe"
  10302.  
  10303. 
  10304. File: libc,  Node: fopen,  Next: fork,  Prev: fnsplit,  Up: Alphabetical List
  10305.  
  10306. fopen
  10307. =====
  10308.  
  10309. Syntax
  10310. ------
  10311.  
  10312.      #include <stdio.h>
  10313.      FILE *fopen(const char *filename, const char *mode);
  10314.  
  10315. Description
  10316. -----------
  10317.  
  10318. This function opens a stream corresponding to the named FILENAME with
  10319. the given MODE.  The mode can be one of the following:
  10320.  
  10321. `r'
  10322.      Open an existing file for reading.
  10323.  
  10324. `w'
  10325.      Create a new file (or truncate an existing file) and open it for
  10326.      writing.
  10327.  
  10328. `a'
  10329.      Open an existing file (or create a new one) for writing.  The file
  10330.      pointer is positioned to the end of the file before every write.
  10331.  
  10332. Followed by any of these characters:
  10333.  
  10334. `b'
  10335.      Force the file to be open in binary mode instead of the default
  10336.      mode.
  10337.  
  10338. `t'
  10339.      Force the file to be open in text mode instead of the default mode.
  10340.  
  10341. `+'
  10342.      Open the file as with `O_RDWR' so that both reads and writes can
  10343.      be done to the same file.
  10344.  
  10345. If the file is open for both reading and writing, you must call
  10346. `fflush', `fseek', or `rewind' before switching from read to write or
  10347. from write to read.
  10348.  
  10349. The open file is set to line buffered if the underlying object is a
  10350. device (stdin, stdout, etc), or is fully buffered if the underlying
  10351. object is a disk file (data.c, etc).
  10352.  
  10353. If `b' or `t' is not specified in MODE, the file type is chosen by the
  10354. value of `fmode' (*note _fmode::.).
  10355.  
  10356. Return Value
  10357. ------------
  10358.  
  10359. A pointer to the `FILE' object, or `NULL' if there was an error.
  10360.  
  10361. Example
  10362. -------
  10363.  
  10364.      FILE *f = fopen("foo", "rb+"); /* open existing file for read/write, binary mode */
  10365.  
  10366. 
  10367. File: libc,  Node: fork,  Next: fpathconf,  Prev: fopen,  Up: Alphabetical List
  10368.  
  10369. fork
  10370. ====
  10371.  
  10372. Description
  10373. -----------
  10374.  
  10375. This function always returns -1 and sets `errno' to ENOMEM, as MS-DOS
  10376. does not support multiple processes.  It exists only to assist in
  10377. porting Unix programs.
  10378.  
  10379. 
  10380. File: libc,  Node: fpathconf,  Next: _fpreset,  Prev: fork,  Up: Alphabetical List
  10381.  
  10382. fpathconf
  10383. =========
  10384.  
  10385. Syntax
  10386. ------
  10387.  
  10388.      #include <unistd.h>
  10389.      
  10390.      long fpathconf(int fd, int name);
  10391.  
  10392. Description
  10393. -----------
  10394.  
  10395. Returns configuration information on the filesystem that the open file
  10396. resides on.  *Note pathconf::.
  10397.  
  10398. Return Value
  10399. ------------
  10400.  
  10401. The configuration value, which are currently independent of the
  10402. filesystem that the file is on.
  10403.  
  10404. 
  10405. File: libc,  Node: _fpreset,  Next: fprintf,  Prev: fpathconf,  Up: Alphabetical List
  10406.  
  10407. _fpreset
  10408. ========
  10409.  
  10410. Syntax
  10411. ------
  10412.  
  10413.      #include <float.h>
  10414.      
  10415.      void _fpreset(void);
  10416.  
  10417. Description
  10418. -----------
  10419.  
  10420. Resets the FPU completely.
  10421.  
  10422. 
  10423. File: libc,  Node: fprintf,  Next: fpurge,  Prev: _fpreset,  Up: Alphabetical List
  10424.  
  10425. fprintf
  10426. =======
  10427.  
  10428. Syntax
  10429. ------
  10430.  
  10431.      #include <stdio.h>
  10432.      
  10433.      int fprintf(FILE *file, const char *format, ...);
  10434.  
  10435. Description
  10436. -----------
  10437.  
  10438. Prints formatted output to the named file.  *Note printf::.
  10439.  
  10440. Return Value
  10441. ------------
  10442.  
  10443. The number of characters written.
  10444.  
  10445. 
  10446. File: libc,  Node: fpurge,  Next: fputc,  Prev: fprintf,  Up: Alphabetical List
  10447.  
  10448. fpurge
  10449. ======
  10450.  
  10451. Syntax
  10452. ------
  10453.  
  10454.      #include <stdio.h>
  10455.      
  10456.      int fpurge(FILE *file);
  10457.  
  10458. Description
  10459. -----------
  10460.  
  10461. This function purges the buffer for FILE without writing it to disk.
  10462.  
  10463. Return Value
  10464. ------------
  10465.  
  10466. Zero on success, -1 on failure.
  10467.  
  10468. 
  10469. File: libc,  Node: fputc,  Next: fputs,  Prev: fpurge,  Up: Alphabetical List
  10470.  
  10471. fputc
  10472. =====
  10473.  
  10474. Syntax
  10475. ------
  10476.  
  10477.      #include <stdio.h>
  10478.      
  10479.      int fputc(int character, FILE *file);
  10480.  
  10481. Description
  10482. -----------
  10483.  
  10484. This function writes the given CHARACTER to the given `file'.
  10485.  
  10486. Return Value
  10487. ------------
  10488.  
  10489. The given character [0..255] or `EOF'.
  10490.  
  10491. Example
  10492. -------
  10493.  
  10494.      fputc('\n', stdout);
  10495.  
  10496. 
  10497. File: libc,  Node: fputs,  Next: fread,  Prev: fputc,  Up: Alphabetical List
  10498.  
  10499. fputs
  10500. =====
  10501.  
  10502. Syntax
  10503. ------
  10504.  
  10505.      #include <stdio.h>
  10506.      
  10507.      int fputs(const char *string, FILE *file);
  10508.  
  10509. Description
  10510. -----------
  10511.  
  10512. This function all the characters of STRING (except the trailing `NULL')
  10513. to the given FILE.
  10514.  
  10515. Return Value
  10516. ------------
  10517.  
  10518. A nonnegative number on success, `EOF' on error.
  10519.  
  10520. Example
  10521. -------
  10522.  
  10523.      fputs("Hello\n", stdout);
  10524.  
  10525. 
  10526. File: libc,  Node: fread,  Next: free,  Prev: fputs,  Up: Alphabetical List
  10527.  
  10528. fread
  10529. =====
  10530.  
  10531. Syntax
  10532. ------
  10533.  
  10534.      #include <stdio.h>
  10535.      
  10536.      size_t fread(void *buffer, size_t size, size_t number, FILE *file);
  10537.  
  10538. Description
  10539. -----------
  10540.  
  10541. This function reads SIZE*NUMBER characters from FILE to BUFFER.
  10542.  
  10543. Return Value
  10544. ------------
  10545.  
  10546. The number of items of size SIZE read, or -1 on error.
  10547.  
  10548. Example
  10549. -------
  10550.  
  10551.      int foo[10];
  10552.      fread(foo, sizeof(int), 10, stdin);
  10553.  
  10554. 
  10555. File: libc,  Node: free,  Next: freopen,  Prev: fread,  Up: Alphabetical List
  10556.  
  10557. free
  10558. ====
  10559.  
  10560. Syntax
  10561. ------
  10562.  
  10563.      #include <stdio.h>
  10564.      
  10565.      void free(void *ptr);
  10566.  
  10567. Description
  10568. -----------
  10569.  
  10570. Returns the allocated memory to the heap (*note malloc::.).  If the PTR
  10571. is `NULL', it does nothing.
  10572.  
  10573. Return Value
  10574. ------------
  10575.  
  10576. None.
  10577.  
  10578. Example
  10579. -------
  10580.  
  10581.      char *q = (char *)malloc(20);
  10582.      free(q);
  10583.  
  10584. 
  10585. File: libc,  Node: freopen,  Next: frexp,  Prev: free,  Up: Alphabetical List
  10586.  
  10587. freopen
  10588. =======
  10589.  
  10590. Syntax
  10591. ------
  10592.  
  10593.      #include <stdio.h>
  10594.      
  10595.      FILE *freopen(const char *filename, const char *mode, FILE *file);
  10596.  
  10597. Description
  10598. -----------
  10599.  
  10600. This function closes FILE if it was open, then opens a new file like
  10601. `fopen(filename, mode)' but it reuses FILE.
  10602.  
  10603. This is useful to, for example, associate `stdout' with a new file.
  10604.  
  10605. Return Value
  10606. ------------
  10607.  
  10608. The new file, or `NULL' on error.
  10609.  
  10610. Example
  10611. -------
  10612.  
  10613.      freopen("/tmp/stdout.dat", "wb", stdout);
  10614.  
  10615. 
  10616. File: libc,  Node: frexp,  Next: fscanf,  Prev: freopen,  Up: Alphabetical List
  10617.  
  10618. frexp
  10619. =====
  10620.  
  10621. Syntax
  10622. ------
  10623.  
  10624.      #include <math.h>
  10625.      
  10626.      double frexp(double x, int *pexp);
  10627.  
  10628. Description
  10629. -----------
  10630.  
  10631. This function separates the given value X into a mantissa [0.5,1) and
  10632. an exponent *PEXP, such that m * 2 ^ e = x.  As an exception, when X is
  10633. zero, *PEXP and the return value are also both zero.
  10634.  
  10635. Return Value
  10636. ------------
  10637.  
  10638. The mantissa.
  10639.  
  10640. 
  10641. File: libc,  Node: fscanf,  Next: fseek,  Prev: frexp,  Up: Alphabetical List
  10642.  
  10643. fscanf
  10644. ======
  10645.  
  10646. Syntax
  10647. ------
  10648.  
  10649.      #include <stdio.h>
  10650.      
  10651.      int fscanf(FILE *file, const char *format, ...);
  10652.  
  10653. Description
  10654. -----------
  10655.  
  10656. This function scans formatted text from FILE and stores it in the
  10657. variables pointed to by the arguments.  *Note scanf::.
  10658.  
  10659. Return Value
  10660. ------------
  10661.  
  10662. The number of items successfully scanned.
  10663.  
  10664. 
  10665. File: libc,  Node: fseek,  Next: fsetpos,  Prev: fscanf,  Up: Alphabetical List
  10666.  
  10667. fseek
  10668. =====
  10669.  
  10670. Syntax
  10671. ------
  10672.  
  10673.      #include <stdio.h>
  10674.      
  10675.      int fseek(FILE *file, long offset, int mode);
  10676.  
  10677. Description
  10678. -----------
  10679.  
  10680. This function moves the file pointer for FILE according to MODE:
  10681.  
  10682. `SEEK_SET'
  10683.      The file pointer is moved to the offset specified.
  10684.  
  10685. `SEEK_CUR'
  10686.      The file pointer is moved relative to its current position.
  10687.  
  10688. `SEEK_END'
  10689.      The file pointer is moved to a position OFFSET bytes from the end
  10690.      of the file.  The offset is usually nonpositive in this case.
  10691.  
  10692. *Warning!* The ANSI standard only allows values of zero for OFFSET when
  10693. WHENCE is not `SEEK_SET' and the file has been opened as a text file.
  10694. Although this restriction is not enforced, beware that there is not a
  10695. one-to-one correspondence between file characters and text characters
  10696. under MS-DOS, so some `fseek' operations may not do exactly what you
  10697. expect.
  10698.  
  10699. Return Value
  10700. ------------
  10701.  
  10702. Zero if successful, nonzero if not.
  10703.  
  10704. Example
  10705. -------
  10706.  
  10707.      fseek(stdin, 12, SEEK_CUR); /* skip 12 bytes */
  10708.  
  10709. 
  10710. File: libc,  Node: fsetpos,  Next: __FSEXT_add_open_handler,  Prev: fseek,  Up: Alphabetical List
  10711.  
  10712. fsetpos
  10713. =======
  10714.  
  10715. Syntax
  10716. ------
  10717.  
  10718.      #include <stdio.h>
  10719.      
  10720.      int fsetpos(FILE *file, const fpos_t *offset);
  10721.  
  10722. Description
  10723. -----------
  10724.  
  10725. This function moves the file pointer for FILE to position OFFSET, as
  10726. recorded by `fgetpos'.
  10727.  
  10728. *Note fgetpos::.  *Note fseek::.
  10729.  
  10730. Return Value
  10731. ------------
  10732.  
  10733. Zero if successful, nonzero if not.
  10734.  
  10735. 
  10736. File: libc,  Node: __FSEXT_add_open_handler,  Next: __FSEXT_alloc_fd,  Prev: fsetpos,  Up: Alphabetical List
  10737.  
  10738. __FSEXT_add_open_handler
  10739. ========================
  10740.  
  10741. Syntax
  10742. ------
  10743.  
  10744.      #include <sys/fsext.h>
  10745.      
  10746.      int __FSEXT_add_open_handler(__FSEXT_Function *_function);
  10747.  
  10748. Description
  10749. -----------
  10750.  
  10751. This function is part of the *Note File System Extensions::.  It is used
  10752. to add a handler for functions that do not get passed descriptors, such
  10753. as `open' and `creat'.
  10754.  
  10755. Example
  10756. -------
  10757.  
  10758.      static int
  10759.      _my_handler(__FSEXT_Fnumber n, int *rv, va_args args)
  10760.      {
  10761.        . . .
  10762.      }
  10763.      
  10764.      int main()
  10765.      {
  10766.        __FSEXT_add_open_handler(_my_handler);
  10767.      }
  10768.  
  10769. 
  10770. File: libc,  Node: __FSEXT_alloc_fd,  Next: __FSEXT_call_open_handlers,  Prev: __FSEXT_add_open_handler,  Up: Alphabetical List
  10771.  
  10772. __FSEXT_alloc_fd
  10773. ================
  10774.  
  10775. Syntax
  10776. ------
  10777.  
  10778.      #include <sys/fsext.h>
  10779.      
  10780.      int __FSEXT_alloc_fd(__FSEXT_Function *_function);
  10781.  
  10782. Description
  10783. -----------
  10784.  
  10785. This function is part of the *Note File System Extensions::.  It is used
  10786. by extensions that fully emulate the I/O functions, and thus don't have
  10787. a corresponding DOS file handle.  This function opens DOS's "nul"
  10788. device, so as to allocate a handle that DOS won't then reuse.  It also
  10789. assigns the handler function for that descriptor.
  10790.  
  10791. The module is responsible for calling `_close' on the descriptor after
  10792. setting the handler function to zero in the extended close handler.
  10793.  
  10794. Example
  10795. -------
  10796.  
  10797.  
  10798.      int socket()
  10799.      {
  10800.        int fd = __FSEXT_alloc_fd(socket_handler);
  10801.        init_socket(fd);
  10802.        return fd;
  10803.      }
  10804.  
  10805. 
  10806. File: libc,  Node: __FSEXT_call_open_handlers,  Next: __FSEXT_get_function,  Prev: __FSEXT_alloc_fd,  Up: Alphabetical List
  10807.  
  10808. __FSEXT_call_open_handlers
  10809. ==========================
  10810.  
  10811. Syntax
  10812. ------
  10813.  
  10814.      #include <sys/fsext.h>
  10815.      
  10816.      int __FSEXT_call_open_handlers(__FSEXT_Fnumber _function_number,
  10817.                         int *rv, va_list _args);
  10818.  
  10819. Description
  10820. -----------
  10821.  
  10822. This function is part of the *Note File System Extensions::.  It is used
  10823. internally to libc.a to allow extensions to get an opportunity to
  10824. override the `open' and `creat' functions.
  10825.  
  10826. 
  10827. File: libc,  Node: __FSEXT_get_function,  Next: __FSEXT_set_function,  Prev: __FSEXT_call_open_handlers,  Up: Alphabetical List
  10828.  
  10829. __FSEXT_get_function
  10830. ====================
  10831.  
  10832. Syntax
  10833. ------
  10834.  
  10835.      #include <sys/fsext.h>
  10836.      
  10837.      __FSEXT_Function *__FSEXT_get_function(int _fd);
  10838.  
  10839. This function is part of the *Note File System Extensions::.  It is used
  10840. internal to libc.a to redirect I/O requests to the appropriate
  10841. extensions.
  10842.  
  10843. Example
  10844. -------
  10845.  
  10846.      _read(int fd, void *buf, int len)
  10847.      {
  10848.        __FSEXT_Function *func = __FSEXT_get_function(fd);
  10849.        if (func)
  10850.        {
  10851.          int rv;
  10852.          if (func(__FSEXT_read, &rv, &fd))
  10853.            return rv;
  10854.        }
  10855.        /* rest of read() */
  10856.      }
  10857.  
  10858. 
  10859. File: libc,  Node: __FSEXT_set_function,  Next: fstat,  Prev: __FSEXT_get_function,  Up: Alphabetical List
  10860.  
  10861. __FSEXT_set_function
  10862. ====================
  10863.  
  10864. Syntax
  10865. ------
  10866.  
  10867.      #include <sys/fsext.h>
  10868.      
  10869.      int __FSEXT_set_function(int _fd, __FSEXT_Function *_function);
  10870.  
  10871. Description
  10872. -----------
  10873.  
  10874. This function is part of the *Note File System Extensions::.  It is used
  10875. to set the handler function for those extensions that use DOS files for
  10876. I/O.  I can't think of any examples where you'd want to do this, but
  10877. it's here in case you do.
  10878.  
  10879. 
  10880. File: libc,  Node: fstat,  Next: fsync,  Prev: __FSEXT_set_function,  Up: Alphabetical List
  10881.  
  10882. fstat
  10883. =====
  10884.  
  10885. Syntax
  10886. ------
  10887.  
  10888.      #include <sys/stat.h>
  10889.      
  10890.      int fstat(int file, struct stat *sbuf);
  10891.  
  10892. Description
  10893. -----------
  10894.  
  10895. This function obtains the status of the open file FILE and stores it in
  10896. SBUF.  *Note stat:: for the description of `struct stat' fields.
  10897.  
  10898. Return Value
  10899. ------------
  10900.  
  10901. Zero on success, nonzero on failure (and ERRNO set).
  10902.  
  10903. Example
  10904. -------
  10905.  
  10906.      struct stat s;
  10907.      fstat(fileno(stdin), &s);
  10908.      if (S_ISREG(s.st_mode))
  10909.        puts("STDIN is a redirected disk file");
  10910.      else if (S_ISCHR(s.st_mode))
  10911.        puts("STDIN is a character device");
  10912.  
  10913. Bugs
  10914. ----
  10915.  
  10916. If a file was open in write-only mode, its execute mode bits might be
  10917. incorrectly reported as if the file were non-executable.  This is
  10918. because some executables are only recognized by reading their first two
  10919. bytes, which cannot be done for files open in write-only mode.
  10920.  
  10921. For `fstat()' to return valid info, you should make sure that all the
  10922. data written to the file has been delivered to the operating system,
  10923. e.g. by calling `fflush()'.  Otherwise, the buffering of the library
  10924. I/O functions might cause stale info to be returned.
  10925.  
  10926. Implementation Notes
  10927. --------------------
  10928.  
  10929. Supplying a 100% Unix-compatible `f?stat()' functions under DOS is an
  10930. implementation nightmare.  The following notes describe some of the
  10931. obscure points specific to their behavior in DJGPP.
  10932.  
  10933. 1. The `drive' for character devices (like `con', `/dev/nul' and others
  10934. is returned as -1.  For drives networked by Novell Netware, it is
  10935. returned as -2.
  10936.  
  10937. 2. The starting cluster number of a file serves as its inode number.
  10938. For files whose starting cluster number is inaccessible (empty files,
  10939. files on networked drives, etc.) the `st_inode' field will be `invented'
  10940. in a way which guarantees that no two different files will get the same
  10941. inode number (thus it is unique).  This invented inode will also be
  10942. different from any real cluster number of any local file.  However, only
  10943. for local, non-empty files/directories the inode is guaranteed to be
  10944. consistent between `stat()' and `fstat()' function calls.
  10945.  
  10946. 3. The WRITE access mode bit is set only for the user (unless the file
  10947. is read-only, hidden or system).  EXECUTE bit is set for directories,
  10948. files which can be executed from the DOS prompt (batch files, .com,
  10949. .dll and .exe executables) or run by go32 extender.  For files which
  10950. reside on networked drives under Novell Netware, this can sometimes
  10951. fail, in which case only the read access bit is set.
  10952.  
  10953. 4. Size of directories is reported as the number of its files (sans `.'
  10954. and `..' entries) multiplied by 32 bytes (the size of directory entry).
  10955.  
  10956. 5. Time stamp for root directories is taken from the volume label entry,
  10957. if that's available; otherwise, it is reported as 1-Jan-1980.
  10958.  
  10959. 6. The variable *Note _djstat_flags:: controls what hard-to-get fields
  10960. of `struct stat' are needed by the application.
  10961.  
  10962. 
  10963. File: libc,  Node: fsync,  Next: ftell,  Prev: fstat,  Up: Alphabetical List
  10964.  
  10965. fsync
  10966. =====
  10967.  
  10968. Syntax
  10969. ------
  10970.  
  10971.      #include <unistd.h>
  10972.      
  10973.      int fsync(int file);
  10974.  
  10975. Description
  10976. -----------
  10977.  
  10978. Forces all information about the file to be synchronized with the disk
  10979. image.
  10980.  
  10981. Return Value
  10982. ------------
  10983.  
  10984. Zero on success, nonzero on failure.
  10985.  
  10986. Example
  10987. -------
  10988.  
  10989.      fsync(fileno(stdout));
  10990.  
  10991. 
  10992. File: libc,  Node: ftell,  Next: ftime,  Prev: fsync,  Up: Alphabetical List
  10993.  
  10994. ftell
  10995. =====
  10996.  
  10997. Syntax
  10998. ------
  10999.  
  11000.      #include <stdio.h>
  11001.      
  11002.      long ftell(FILE *file);
  11003.  
  11004. Description
  11005. -----------
  11006.  
  11007. Returns the current file position for `file'.  This is suitable for a
  11008. future call to `fseek'.
  11009.  
  11010. Return Value
  11011. ------------
  11012.  
  11013. The file position, or -1 on error.
  11014.  
  11015. Example
  11016. -------
  11017.  
  11018.      long p = ftell(stdout);
  11019.  
  11020. 
  11021. File: libc,  Node: ftime,  Next: ftruncate,  Prev: ftell,  Up: Alphabetical List
  11022.  
  11023. ftime
  11024. =====
  11025.  
  11026. Syntax
  11027. ------
  11028.  
  11029.      #include <sys/timeb.h>
  11030.      
  11031.      int ftime(struct timeb *buf);
  11032.  
  11033. Description
  11034. -----------
  11035.  
  11036. This function stores the current time in the structure BUF.  The format
  11037. of `struct timeb' is:
  11038.  
  11039.      struct timeb {
  11040.        time_t         time;     /* seconds since 00:00:00 GMT 1/1/1970 */
  11041.        unsigned short millitm;  /* milliseconds */
  11042.        short          timezone; /* difference between GMT and local, minutes */
  11043.        short          dstflag;  /* set if daylight savings time in affect */
  11044.      };
  11045.  
  11046. Return Value
  11047. ------------
  11048.  
  11049. Zero on success, nonzero on error.
  11050.  
  11051. Example
  11052. -------
  11053.  
  11054.      struct timeb t;
  11055.      ftime(&t);
  11056.  
  11057. 
  11058. File: libc,  Node: ftruncate,  Next: ftw,  Prev: ftime,  Up: Alphabetical List
  11059.  
  11060. ftruncate
  11061. =========
  11062.  
  11063. Syntax
  11064. ------
  11065.  
  11066.      #include <unistd.h>
  11067.      
  11068.      int ftruncate(int file, off_t where);
  11069.  
  11070. Description
  11071. -----------
  11072.  
  11073. This function truncates FILE at WHERE length.  This only works if the
  11074. file is closed right after this call.
  11075.  
  11076. Return Value
  11077. ------------
  11078.  
  11079. Zero for success, nonzero for failure.
  11080.  
  11081. Example
  11082. -------
  11083.  
  11084.      int x = open("data", O_WRONLY);
  11085.      ftruncate(x, 1000);
  11086.      close(x);
  11087.  
  11088. 
  11089. File: libc,  Node: ftw,  Next: _fwalk,  Prev: ftruncate,  Up: Alphabetical List
  11090.  
  11091. ftw
  11092. ===
  11093.  
  11094. Syntax
  11095. ------
  11096.  
  11097.      #include <ftw.h>
  11098.      
  11099.      int ftw(const char *dir,
  11100.              int (*func)(const char *path, struct stat *stbuf, int flag),
  11101.              int depth);
  11102.  
  11103. Description
  11104. -----------
  11105.  
  11106. This function recursively descends the directory hierarchy which starts
  11107. with DIR.  For each file in the hierarchy, `ftw' calls the user-defined
  11108. function FUNC which is passed a pointer to a `NULL'-terminated
  11109. character array in PATH holding the full pathname of the file, a
  11110. pointer to a `stat' structure (*note stat::.) STBUF with a filesystem
  11111. information about that file, and an integer FLAG.  Possible values of
  11112. FLAG are:
  11113.  
  11114. `FTW_F'
  11115.      This is a regular file.
  11116.  
  11117. `FTW_D'
  11118.      This is a directory.
  11119.  
  11120. `FTW_VL'
  11121.      This is a volume label.
  11122.  
  11123. `FTW_DNR'
  11124.      This is a directory which cannot be read with `readdir()'.  (This
  11125.      will never happen in DJGPP.)
  11126.  
  11127. `FTW_NS'
  11128.      This file exists, but `stat' fails for it.
  11129.  
  11130. If FLAG is `FTW_DNR', the descendants of that directory won't be
  11131. processed.  If FLAG is `FTW_NS', then STBUF will be garbled.
  11132.  
  11133. This function always visits a directory before any of its siblings.  The
  11134. argument DIR must be a directory, or `ftw' will fail and set ERRNO to
  11135. `ENOTDIR'.  The function FUNC is called with DIR as its argument before
  11136. the recursive descent begins.
  11137.  
  11138. The DEPTH argument has no meaning in the DJGPP implementation and is
  11139. always ignored.
  11140.  
  11141. The tree traversal continues until one of the following events:
  11142.  
  11143. (1)  The tree is exhausted (i.e., all descendants of DIR are
  11144. processed).  In this case, `ftw' returns 0, meaning a success.
  11145.  
  11146. (2)  An invocation of FUNC returns a non-zero value.  In this case,
  11147. `ftw' stops the tree traversal and returns whatever FUNC returned.
  11148.  
  11149. (3)  An error is detected within `ftw'.  In that case, `ftw' returns -1
  11150. and sets ERRNO (*note errno::.) to a suitable value.
  11151.  
  11152. Return Value
  11153. ------------
  11154.  
  11155. Zero in case the entire tree was successfully traversed, -1 if `ftw'
  11156. detected some error during its operation, or any other non-zero value
  11157. which was returned by the user-defined function FUNC.
  11158.  
  11159. Implementation Notes
  11160. --------------------
  11161.  
  11162. This function uses `malloc' (*note malloc::.) for dynamic memory
  11163. allocation during its operation.  If FUNC disrupts the normal flow of
  11164. code execution by e.g. calling `longjump' or if an interrupt handler
  11165. which never returns is executed, this memory will remain permanently
  11166. allocated.
  11167.  
  11168. This function calls `opendir()' and `readdir()' functions to read the
  11169. directory entries.  Therefore, you can control what files will your
  11170. FUNC get by setting the appropriate bits in the external variable
  11171. __OPENDIR_FLAGS.  *Note opendir::, for description of these bits.
  11172.  
  11173. This function also calls `stat' for every directory entry it passes to
  11174. FUNC.  If your application only needs some part of the information
  11175. returned in the `stat' structure, you can make your application
  11176. significantly faster by setting bits in the external variable
  11177. _DJSTAT_FLAGS (*note _djstat_flags::. for details).  The most expensive
  11178. `stat' features are `_STAT_EXEC_MAGIC' and `_STAT_DIRSIZE'.
  11179.  
  11180. Example
  11181. -------
  11182.  
  11183.      #include <stdlib.h>
  11184.      
  11185.      int
  11186.      file_walker(const char *path, struct stat *sb, int flag)
  11187.      {
  11188.        char *base;
  11189.      
  11190.        printf("%s:\t%u\t", path, sb->st_size);
  11191.        if (S_ISLABEL(sb->st_mode))
  11192.          printf("V");
  11193.        if (S_ISDIR(sb->st_mode))
  11194.          printf("D");
  11195.        if (S_ISCHR(sb->st_mode))
  11196.          printf("C");
  11197.        if (sb->st_mode & S_IRUSR)
  11198.          printf("r");
  11199.        if (sb->st_mode & S_IWUSR)
  11200.          printf("w");
  11201.        if (sb->st_mode & S_IXUSR)
  11202.          printf("x");
  11203.      
  11204.        if (flag == FTW_NS)
  11205.          printf("  !!no_stat!!");
  11206.        printf("\n");
  11207.      
  11208.        base = strrchr(path, '/');
  11209.        if (base == 0)
  11210.          base = strrchr(path, '\\');
  11211.        if (base == 0)
  11212.          base = strrchr(path, ':');
  11213.        if (strcmp(base == 0 ? path : base + 1, "xxxxx") == 0)
  11214.          return 42;
  11215.        return 0;
  11216.      }
  11217.      
  11218.      int
  11219.      main(int argc, char *argv[])
  11220.      {
  11221.        if (argc > 1)
  11222.          {
  11223.            char msg[80];
  11224.      
  11225.            sprintf(msg, "file_tree_walk: %d",
  11226.                         ftw(argv[1], file_walker, 0));
  11227.            if (errno)
  11228.              perror(msg);
  11229.            else
  11230.              puts(msg);
  11231.          }
  11232.        else
  11233.          printf("Usage: %s dir\n", argv[0]);
  11234.      
  11235.        return 0;
  11236.      }
  11237.  
  11238. 
  11239. File: libc,  Node: _fwalk,  Next: fwrite,  Prev: ftw,  Up: Alphabetical List
  11240.  
  11241. _fwalk
  11242. ======
  11243.  
  11244. Syntax
  11245. ------
  11246.  
  11247.      void _fwalk(void (*function)(FILE *file));
  11248.  
  11249. Description
  11250. -----------
  11251.  
  11252. For each open file in the system, the given FUNCTION is called, passing
  11253. the file pointer as it's only argument
  11254.  
  11255. Return Value
  11256. ------------
  11257.  
  11258. None.
  11259.  
  11260. Example
  11261. -------
  11262.  
  11263.      void pfile(FILE *x)
  11264.      { printf("FILE at %p\n", x); }
  11265.      
  11266.      _fwalk(pfile);
  11267.  
  11268. 
  11269. File: libc,  Node: fwrite,  Next: _get_dev_info,  Prev: _fwalk,  Up: Alphabetical List
  11270.  
  11271. fwrite
  11272. ======
  11273.  
  11274. Syntax
  11275. ------
  11276.  
  11277.      #include <stdio.h>
  11278.      
  11279.      size_t fwrite(void *buffer, size_t size, size_t number, FILE *file);
  11280.  
  11281. Description
  11282. -----------
  11283.  
  11284. This function writes SIZE*NUMBER characters from BUFFER to FILE.
  11285.  
  11286. Return Value
  11287. ------------
  11288.  
  11289. The number of items of size SIZE written, or -1 on error.
  11290.  
  11291. Example
  11292. -------
  11293.  
  11294.      int foo[10];
  11295.      fwrite(foo, sizeof(int), 10, stdin);
  11296.  
  11297. 
  11298. File: libc,  Node: _get_dev_info,  Next: _get_dos_version,  Prev: fwrite,  Up: Alphabetical List
  11299.  
  11300. _get_dev_info
  11301. =============
  11302.  
  11303. Syntax
  11304. ------
  11305.  
  11306.      #include <io.h>
  11307.      
  11308.      short _get_dev_info(int arg);
  11309.  
  11310. Description
  11311. -----------
  11312.  
  11313. Given drive_number (A: = 0, B: = 1, etc.) or a file handle in ARG, this
  11314. function returns the device info word which is returned by DOS IOCTL
  11315. function 0 (Int 21h/AX=4400h).  In case of error, -1 is returned and
  11316. ERRNO is set.
  11317.  
  11318. 
  11319. File: libc,  Node: _get_dos_version,  Next: getc,  Prev: _get_dev_info,  Up: Alphabetical List
  11320.  
  11321. _get_dos_version
  11322. ================
  11323.  
  11324. Syntax
  11325. ------
  11326.  
  11327.      #include <dos.h>
  11328.      
  11329.      extern unsigned short   _osmajor, _osminor;
  11330.      extern const    char  * _os_flavor;
  11331.      
  11332.      unsigned short _get_dos_version(int true_version);
  11333.  
  11334. Description
  11335. -----------
  11336.  
  11337. This function gets the host OS version and flavor.  If the argument
  11338. TRUE_VERSION is non-zero, it will return a `true' version number, which
  11339. is unaffected by possible tinkering with SETVER TSR program.  (This is
  11340. only available in DOS 5.0 or later.)
  11341.  
  11342. The external variables `_osmajor' and `_osminor' will always be set to
  11343. the major and minor parts of the `advertised' version number, possibly
  11344. changed by SETVER, even if TRUE_VERSION is non-zero.  You typically
  11345. need the true version when you need an intimate knowledge of the host
  11346. OS internals, like when using undocumented features.  Note that some
  11347. DOS clones (notably, DR-DOS) do not support DOS function required to
  11348. report the true DOS version; for these, the version reported might be
  11349. affected by SETVER even if TRUE_VERSION is non-zero.
  11350.  
  11351. The external variable `_os_flavor' will point to a string which
  11352. describes the OEM name of the host OS variety.
  11353.  
  11354. Return Value
  11355. ------------
  11356.  
  11357. `_get_dos_version()' returns the version number (true version number,
  11358. if TRUE_VERSION is non-zero) as a 16-bit number: the major part of the
  11359. version in the upper 8 bits, the minor part in the lower 8 bits.  For
  11360. instance, DOS version 6.20 will be returned as 0x0614.
  11361.  
  11362. Example
  11363. -------
  11364.  
  11365.        unsigned short true_dos_version = _get_dos_version(1);
  11366.      
  11367.        if (true_dos_version < 0x0614)   /* require DOS 6.20 or later */
  11368.          puts("This program needs DOS 6.20 or later to run");
  11369.        else
  11370.          printf("You are running %s variety of DOS\n", _os_flavor);
  11371.  
  11372. 
  11373. File: libc,  Node: getc,  Next: getcbrk,  Prev: _get_dos_version,  Up: Alphabetical List
  11374.  
  11375. getc
  11376. ====
  11377.  
  11378. Syntax
  11379. ------
  11380.  
  11381.      #include <stdio.h>
  11382.      
  11383.      int getc(FILE *file);
  11384.  
  11385. Description
  11386. -----------
  11387.  
  11388. Get one character from FILE.
  11389.  
  11390. Return Value
  11391. ------------
  11392.  
  11393. The character ([0..255]) or `EOF' if eof or error.
  11394.  
  11395. Example
  11396. -------
  11397.  
  11398.      int c;
  11399.      while ((c=getc(stdin)) != EOF)
  11400.        putc(c, stdout);
  11401.  
  11402. 
  11403. File: libc,  Node: getcbrk,  Next: getch,  Prev: getc,  Up: Alphabetical List
  11404.  
  11405. getcbrk
  11406. =======
  11407.  
  11408. Syntax
  11409. ------
  11410.  
  11411.      #include <dos.h>
  11412.      
  11413.      int getcbrk(void);
  11414.  
  11415. Description
  11416. -----------
  11417.  
  11418. Get the setting of the Ctrl-C checking flag in MS-DOS.
  11419.  
  11420. *Note setcbrk::.
  11421.  
  11422. Return Value
  11423. ------------
  11424.  
  11425. 0 if not checking, 1 if checking.
  11426.  
  11427. 
  11428. File: libc,  Node: getch,  Next: getchar,  Prev: getcbrk,  Up: Alphabetical List
  11429.  
  11430. getch
  11431. =====
  11432.  
  11433. Syntax
  11434. ------
  11435.  
  11436.      #include <conio.h>
  11437.      
  11438.      int     getch(void);
  11439.  
  11440. Description
  11441. -----------
  11442.  
  11443. A single character from the console (stdin) is returned.  The input is
  11444. not line-buffered.  If there is a character pending from *Note
  11445. ungetch::, it is returned instead.  The character is not echoed to the
  11446. screen.
  11447.  
  11448. Return Value
  11449. ------------
  11450.  
  11451. The character.
  11452.  
  11453. 
  11454. File: libc,  Node: getchar,  Next: getche,  Prev: getch,  Up: Alphabetical List
  11455.  
  11456. getchar
  11457. =======
  11458.  
  11459. Syntax
  11460. ------
  11461.  
  11462.      #include <stdio.h>
  11463.      
  11464.      int getchar(void);
  11465.  
  11466. Description
  11467. -----------
  11468.  
  11469. The same as `fgetc(stdin)' (*note fgetc::.).
  11470.  
  11471. Return Value
  11472. ------------
  11473.  
  11474. The character, or `EOF'.
  11475.  
  11476. 
  11477. File: libc,  Node: getche,  Next: getcwd,  Prev: getchar,  Up: Alphabetical List
  11478.  
  11479. getche
  11480. ======
  11481.  
  11482. Syntax
  11483. ------
  11484.  
  11485.      #include <conio.h>
  11486.      
  11487.      int getche(void);
  11488.  
  11489. Description
  11490. -----------
  11491.  
  11492. A single character from the console (stdin) is returned.  The input is
  11493. not line-buffered.  If there is a character pending from *Note
  11494. ungetch::, it is returned instead.  The character is echoed to the
  11495. screen.
  11496.  
  11497. Return Value
  11498. ------------
  11499.  
  11500. The character.
  11501.  
  11502. 
  11503. File: libc,  Node: getcwd,  Next: getdate,  Prev: getche,  Up: Alphabetical List
  11504.  
  11505. getcwd
  11506. ======
  11507.  
  11508. Syntax
  11509. ------
  11510.  
  11511.      #include <unistd.h>
  11512.      
  11513.      char *getcwd(char *buffer, int max);
  11514.  
  11515. Description
  11516. -----------
  11517.  
  11518. Get the current directory.  The return value includes the drive
  11519. specifier.  If BUFFER is `NULL', `getcwd' allocates memory with
  11520. `malloc'.  This call fails if more than MAX characters are required to
  11521. specify the current directory.
  11522.  
  11523. Return Value
  11524. ------------
  11525.  
  11526. The buffer, either BUFFER or a newly-allocated buffer, or `NULL' on
  11527. error.
  11528.  
  11529. Example
  11530. -------
  11531.  
  11532.      char *buf = (char *)malloc(PATH_MAX);
  11533.      if (buf && getcwd(buf, PATH_MAX))
  11534.      {
  11535.        printf("cwd is %s\n", buf);
  11536.        free(buf);
  11537.      }
  11538.  
  11539. 
  11540. File: libc,  Node: getdate,  Next: getdfree,  Prev: getcwd,  Up: Alphabetical List
  11541.  
  11542. getdate
  11543. =======
  11544.  
  11545. Syntax
  11546. ------
  11547.  
  11548.      #include <dos.h>
  11549.      
  11550.      void getdate(struct date *);
  11551.  
  11552. Description
  11553. -----------
  11554.  
  11555. This function gets the current date.  The return structure is as
  11556. follows:
  11557.  
  11558.      struct date {
  11559.        short da_year;
  11560.        char  da_day;
  11561.        char  da_mon;
  11562.      };
  11563.  
  11564. *Note setdate::. *Note gettime::.
  11565.  
  11566. Return Value
  11567. ------------
  11568.  
  11569. None.
  11570.  
  11571. Example
  11572. -------
  11573.  
  11574.      struct date d;
  11575.      getdate(&d);
  11576.  
  11577. 
  11578. File: libc,  Node: getdfree,  Next: getdisk,  Prev: getdate,  Up: Alphabetical List
  11579.  
  11580. getdfree
  11581. ========
  11582.  
  11583. Syntax
  11584. ------
  11585.  
  11586.      #include <dos.h>
  11587.      
  11588.      void getdfree(unsigned char drive, struct dfree *ptr);
  11589.  
  11590. Description
  11591. -----------
  11592.  
  11593. This function gets information about the size and fullness of the given
  11594. drive (0=default, 1=A:, etc).  The return structure is as follows:
  11595.  
  11596.      struct dfree {
  11597.        unsigned df_avail; /* number of available clusters */
  11598.        unsigned df_total; /* total number of clusters */
  11599.        unsigned df_bsec;  /* bytes per sector */
  11600.        unsigned df_sclus; /* sectors per cluster */
  11601.      };
  11602.  
  11603. Return Value
  11604. ------------
  11605.  
  11606. None.
  11607.  
  11608. Example
  11609. -------
  11610.  
  11611.      struct dfree d;
  11612.      getdfree(3, &d); /* drive C: */
  11613.  
  11614. 
  11615. File: libc,  Node: getdisk,  Next: getdtablesize,  Prev: getdfree,  Up: Alphabetical List
  11616.  
  11617. getdisk
  11618. =======
  11619.  
  11620. Syntax
  11621. ------
  11622.  
  11623.      #include <dir.h>
  11624.      
  11625.      int getdisk(void);
  11626.  
  11627. Description
  11628. -----------
  11629.  
  11630. Gets the current disk (0=A).
  11631.  
  11632. *Note setdisk::.
  11633.  
  11634. Return Value
  11635. ------------
  11636.  
  11637. The current disk number.
  11638.  
  11639. Example
  11640. -------
  11641.  
  11642.      printf("This drive is %c:\n", getdisk() + 'A');
  11643.  
  11644. 
  11645. File: libc,  Node: getdtablesize,  Next: getegid,  Prev: getdisk,  Up: Alphabetical List
  11646.  
  11647. getdtablesize
  11648. =============
  11649.  
  11650. Syntax
  11651. ------
  11652.  
  11653.      #include <unistd.h>
  11654.      
  11655.      int getdtablesize(void);
  11656.  
  11657. Description
  11658. -----------
  11659.  
  11660. Get the maximum number of open file descriptors the system supports.
  11661.  
  11662. Return Value
  11663. ------------
  11664.  
  11665. 255
  11666.  
  11667. 
  11668. File: libc,  Node: getegid,  Next: getenv,  Prev: getdtablesize,  Up: Alphabetical List
  11669.  
  11670. getegid
  11671. =======
  11672.  
  11673. Syntax
  11674. ------
  11675.  
  11676.      #include <unistd.h>
  11677.      
  11678.      int getegid(void);
  11679.  
  11680. Description
  11681. -----------
  11682.  
  11683. Get the effective group id.
  11684.  
  11685. Return Value
  11686. ------------
  11687.  
  11688. 42
  11689.  
  11690. 
  11691. File: libc,  Node: getenv,  Next: geteuid,  Prev: getegid,  Up: Alphabetical List
  11692.  
  11693. getenv
  11694. ======
  11695.  
  11696. Syntax
  11697. ------
  11698.  
  11699.      #include <stdlib.h>
  11700.      
  11701.      char *getenv(const char *name);
  11702.  
  11703. Description
  11704. -----------
  11705.  
  11706. Get the setting of the environment variable NAME.  Do not alter or free
  11707. the returned value.
  11708.  
  11709. Return Value
  11710. ------------
  11711.  
  11712. The value, or `NULL' if that variable does not exist.
  11713.  
  11714. Example
  11715. -------
  11716.  
  11717.      char *term = getenv("TERM");
  11718.  
  11719. 
  11720. File: libc,  Node: geteuid,  Next: getftime,  Prev: getenv,  Up: Alphabetical List
  11721.  
  11722. geteuid
  11723. =======
  11724.  
  11725. Syntax
  11726. ------
  11727.  
  11728.      #include <unistd.h>
  11729.      
  11730.      int geteuid(void);
  11731.  
  11732. Description
  11733. -----------
  11734.  
  11735. Gets the effective UID.
  11736.  
  11737. Return Value
  11738. ------------
  11739.  
  11740. 42
  11741.  
  11742. 
  11743. File: libc,  Node: getftime,  Next: getgid,  Prev: geteuid,  Up: Alphabetical List
  11744.  
  11745. getftime
  11746. ========
  11747.  
  11748. Syntax
  11749. ------
  11750.  
  11751.      #include <dos.h>
  11752.      
  11753.      int getftime(int handle, struct ftime *ptr);
  11754.  
  11755. Description
  11756. -----------
  11757.  
  11758. Get the timestamp for the given file handle.  The return structure is as
  11759. follows:
  11760.  
  11761.      struct ftime {
  11762.        unsigned ft_tsec:5;    /* 0-29, double to get real seconds */
  11763.        unsigned ft_min:6;    /* 0-59 */
  11764.        unsigned ft_hour:5;    /* 0-23 */
  11765.        unsigned ft_day:5;    /* 1-31 */
  11766.        unsigned ft_month:4;    /* 1-12 */
  11767.        unsigned ft_year:7;    /* since 1980 */
  11768.      }
  11769.  
  11770. Return Value
  11771. ------------
  11772.  
  11773. Zero on success, nonzero on failure.
  11774.  
  11775. Example
  11776. -------
  11777.  
  11778.      struct ftime t;
  11779.      getftime(fd, &t);
  11780.  
  11781. 
  11782. File: libc,  Node: getgid,  Next: getgrent,  Prev: getftime,  Up: Alphabetical List
  11783.  
  11784. getgid
  11785. ======
  11786.  
  11787. Syntax
  11788. ------
  11789.  
  11790.      #include <unistd.h>
  11791.      
  11792.      int getgid(void);
  11793.  
  11794. Description
  11795. -----------
  11796.  
  11797. Get the current group id.
  11798.  
  11799. Return Value
  11800. ------------
  11801.  
  11802. 42
  11803.  
  11804. 
  11805. File: libc,  Node: getgrent,  Next: getgrgid,  Prev: getgid,  Up: Alphabetical List
  11806.  
  11807. getgrent
  11808. ========
  11809.  
  11810. Syntax
  11811. ------
  11812.  
  11813.      #include <grp.h>
  11814.      
  11815.      struct group *getgrent(void);
  11816.  
  11817. Description
  11818. -----------
  11819.  
  11820. This function returns the next available group entry.  Note that for
  11821. MS-DOS, this is simulated.  If the environment variable GROUP is set,
  11822. that is the name of the only group returned, else the only group is
  11823. "dos".  Thus, under DOS, `getgrent' will always fail on the second and
  11824. subsequent calls.
  11825.  
  11826. The return type of this and related function is as follows:
  11827.  
  11828.      struct group {
  11829.        gid_t    gr_gid;    /* result of getgid() */
  11830.        char  ** gr_mem;    /* gr_mem[0] points to
  11831.                                getenv("USER"/"LOGNAME") or "user" */
  11832.        char  *  gr_name;   /* getenv("GROUP") or "dos" */
  11833.      };
  11834.  
  11835. Return Value
  11836. ------------
  11837.  
  11838. The next structure, or `NULL' at the end of the list.
  11839.  
  11840. Example
  11841. -------
  11842.  
  11843.  
  11844.      struct group *g;
  11845.      setgrent();
  11846.      while ((g = getgrent()) != NULL)
  11847.      {
  11848.        printf("group %s gid %d\n", g->gr_name, g->gr_gid);
  11849.      }
  11850.      endgrent();
  11851.  
  11852. 
  11853. File: libc,  Node: getgrgid,  Next: getgrnam,  Prev: getgrent,  Up: Alphabetical List
  11854.  
  11855. getgrgid
  11856. ========
  11857.  
  11858. Syntax
  11859. ------
  11860.  
  11861.      #include <grp.h>
  11862.      
  11863.      extern struct group *getgrgid(int gid);
  11864.  
  11865. Description
  11866. -----------
  11867.  
  11868. This function returns the group entry that matches GID.  *Note
  11869. getgrent::, for the description of `struct group'.
  11870.  
  11871. Return Value
  11872. ------------
  11873.  
  11874. The matching group, or `NULL' if none match.
  11875.  
  11876. 
  11877. File: libc,  Node: getgrnam,  Next: gethostname,  Prev: getgrgid,  Up: Alphabetical List
  11878.  
  11879. getgrnam
  11880. ========
  11881.  
  11882. Syntax
  11883. ------
  11884.  
  11885.      #include <grp.h>
  11886.      
  11887.      struct group *getgrnam(char *name);
  11888.  
  11889. Description
  11890. -----------
  11891.  
  11892. This function returns the group entry for the group named NAME.  *Note
  11893. getgrent:: for the description of `struct group'.
  11894.  
  11895. Return Value
  11896. ------------
  11897.  
  11898. The matching group, or `NULL' if none match.
  11899.  
  11900. 
  11901. File: libc,  Node: gethostname,  Next: getitimer,  Prev: getgrnam,  Up: Alphabetical List
  11902.  
  11903. gethostname
  11904. ===========
  11905.  
  11906. Syntax
  11907. ------
  11908.  
  11909.      #include <unistd.h>
  11910.      #include <sys/param.h>
  11911.      
  11912.      int gethostname (char *buf, int size);
  11913.  
  11914. Description
  11915. -----------
  11916.  
  11917. Get the name of the host the program is executing on.  This name is
  11918. obtained from the network software, if present, otherwise from the
  11919. `"HOSTNAME"' environment variable, if present, finally defaulting to
  11920. `"pc"'.
  11921.  
  11922. The call fails if more than SIZE characters are required to specify the
  11923. host name.  A buffer size of `MAXGETHOSTNAME' is guaranteed to be
  11924. enough.
  11925.  
  11926. Return Value
  11927. ------------
  11928.  
  11929. Zero on success, nonzero on failure.
  11930.  
  11931. Example
  11932. -------
  11933.  
  11934.      char *buf = (char *) malloc (MAXGETHOSTNAME);
  11935.      if (buf && 0 == gethostname (buf, MAXGETHOSTNAME))
  11936.        printf ("We're on %s\n", buf);
  11937.      if (buf) free(buf);
  11938.  
  11939. 
  11940. File: libc,  Node: getitimer,  Next: getkey,  Prev: gethostname,  Up: Alphabetical List
  11941.  
  11942. getitimer
  11943. =========
  11944.  
  11945. Syntax
  11946. ------
  11947.  
  11948.      #include <sys/time.h>
  11949.      
  11950.      int getitimer(int which, struct itimerval *value);
  11951.  
  11952. Description
  11953. -----------
  11954.  
  11955. This function gets the current value of the interval timer specified by
  11956. WHICH into structure VALUE.  Variable WHICH can have the value of
  11957. ITIMER_REAL or ITIMER_PROF. *Note setitimer::.
  11958.  
  11959. Return Value
  11960. ------------
  11961.  
  11962. Returns 0 on success, -1 on failure (and sets errno).
  11963.  
  11964. 
  11965. File: libc,  Node: getkey,  Next: getlogin,  Prev: getitimer,  Up: Alphabetical List
  11966.  
  11967. getkey
  11968. ======
  11969.  
  11970. Syntax
  11971. ------
  11972.  
  11973.      #include <pc.h>
  11974.      #include <keys.h>
  11975.      
  11976.      int getkey(void);
  11977.  
  11978. Description
  11979. -----------
  11980.  
  11981. Waits for the user to press one key, then returns that key.  Alt-key
  11982. combinations have 0x100 added to them.  Extended keys return their
  11983. non-extended codes.
  11984.  
  11985. The file `keys.h' has symbolic names for many of the keys.
  11986.  
  11987. *Note getxkey::.
  11988.  
  11989. Return Value
  11990. ------------
  11991.  
  11992. The key pressed.
  11993.  
  11994. Example
  11995. -------
  11996.  
  11997.      while (getkey() != K_Alt_3)
  11998.        do_something();
  11999.  
  12000. 
  12001. File: libc,  Node: getlogin,  Next: getlongpass,  Prev: getkey,  Up: Alphabetical List
  12002.  
  12003. getlogin
  12004. ========
  12005.  
  12006. Syntax
  12007. ------
  12008.  
  12009.      #include <unistd.h>
  12010.      
  12011.      char *getlogin(void);
  12012.  
  12013. Description
  12014. -----------
  12015.  
  12016. Get the login ID of the user.
  12017.  
  12018. Return Value
  12019. ------------
  12020.  
  12021. Returns the value of the `USER' environment variable, else the
  12022. `LOGNAME' environment variable, else `"dosuser"'.
  12023.  
  12024. Example
  12025. -------
  12026.  
  12027.      printf("I am %s\n", getlogin());
  12028.  
  12029. 
  12030. File: libc,  Node: getlongpass,  Next: getmntent,  Prev: getlogin,  Up: Alphabetical List
  12031.  
  12032. getlongpass
  12033. ===========
  12034.  
  12035. Syntax
  12036. ------
  12037.  
  12038.      #include <stdlib.h>
  12039.      
  12040.      int  getlongpass(const char *prompt, char *password, int max_length)
  12041.  
  12042. Description
  12043. -----------
  12044.  
  12045. This function reads up to a Newline (CR or LF) or EOF (Ctrl-D or Ctrl-Z)
  12046. from the standard input, without an echo, after prompting with a
  12047. null-terminated string PROMPT.  It puts a null-terminated string of at
  12048. most MAX_LENGTH - 1 first characters typed by the user into a buffer
  12049. pointed to by PASSWORD.  Pressing Ctrl-C or Ctrl-Break will cause the
  12050. calling program to `exit(1)'.
  12051.  
  12052. Return Value
  12053. ------------
  12054.  
  12055. Zero if successfull, -1 on error (and ERRNO is set to and appropriate
  12056. value.
  12057.  
  12058. Example
  12059. -------
  12060.  
  12061.      char password[MAX_PASS];
  12062.      
  12063.      (void)getlongpass("Password: ", password, MAX_PASS);
  12064.  
  12065. 
  12066. File: libc,  Node: getmntent,  Next: getpagesize,  Prev: getlongpass,  Up: Alphabetical List
  12067.  
  12068. getmntent
  12069. =========
  12070.  
  12071. Syntax
  12072. ------
  12073.  
  12074.      #include <mntent.h>
  12075.      
  12076.      struct mntent *getmntent(FILE *filep);
  12077.  
  12078. Description
  12079. -----------
  12080.  
  12081. This function returns information about the various drives that are
  12082. available to your program.  Beginning with drive `A:', information is
  12083. retrieved for successive drives with successive calls to `getmntent'.
  12084. Note that drives `A:' and `B:' will only be returned if there is an
  12085. MS-DOS formatted disk in the drive; empty drives are skipped.  For
  12086. systems with a single floppy drive, it is returned as if it were
  12087. mounted on A:/ or B:/, depending on how it was last referenced (and if
  12088. there is a disk in the drive).
  12089.  
  12090. For each drive scanned, a pointer to a static structure of the following
  12091. type is returned:
  12092.  
  12093.      struct mntent
  12094.      {
  12095.          char * mnt_fsname;  /* The name of this file system */
  12096.          char * mnt_dir;     /* The root directory of this file system */
  12097.          char * mnt_type;    /* Filesystem type */
  12098.          char * mnt_opts;    /* Options, see below */
  12099.          int    mnt_freq;    /* -1 */
  12100.          int    mnt_passno;  /* -1 */
  12101.          long   mnt_time;    /* -1 */
  12102.      };
  12103.  
  12104. DJGPP implementation returns the following in the first 4 fields of
  12105. `struct mntent':
  12106.  
  12107. `mnt_fsname'
  12108.      For networked and CD-ROM drives, the name of root directory in the
  12109.      form "\\HOST\PATH" (this is called a UNC name).
  12110.  
  12111.      For drives compressed with DoubleSpace, the string
  12112.      "X:\DBLSPACE.NNN", where "X" is the drive letter of the host drive
  12113.      and "NNN" is the sequence number of the Compressed Volume File.
  12114.  
  12115.      For drives compressed with Stacker, the string "X:\STACVOL.NNN",
  12116.      where "X" and "NNN" are as for DoubleSpace drives.
  12117.  
  12118.      For SUBSTed drives, the actual directory name that that was
  12119.      SUBSTed to emulate a drive.
  12120.  
  12121.      JOINed drives get their name as if they were NOT JOINed (i.e.,
  12122.      either the label name or the default "Drive X:").
  12123.  
  12124.      For drives with a volume label, the name of the label; otherwise
  12125.      the string "Drive X:", where "X" is the drive letter.
  12126.  
  12127. `mnt_dir'
  12128.      For most drives, the name of its root directory "X:/" (where "X" is
  12129.      the drive letter), except that JOINed drives get this as the name
  12130.      of the directory to which they were JOINed.
  12131.  
  12132.      For systems with a single floppy drive (which can be referenced as
  12133.      either "a:/" or "b:/"), the mount directory will be returned as
  12134.      one of these, depending on which drive letter was last used to
  12135.      reference that drive.
  12136.  
  12137. `mnt_type'
  12138.            "fd"     for floppy disks
  12139.            "hd"     for hard disks
  12140.            "dblsp"  for disks compressed with DoubleSpace
  12141.            "stac"   for disks compressed with Stacker
  12142.            "cdrom"  for CD-ROM drives
  12143.            "ram"    for RAM disks
  12144.            "subst"  for SUBSTed directories
  12145.            "join"   for JOINed disks
  12146.            "net"    for networked drives
  12147.  
  12148. `mnt_opts'
  12149.      The string "ro,dev=XX" for CD-ROM drives, "rw,dev=XX" for all the
  12150.      others, where "XX" is the hexadecimal drive number of the REAL
  12151.      drive on which this filesystem resides.  That is, if you call
  12152.      `stat' on MNT_FSNAME, you will get the numeric equivalent of XX in
  12153.      `st_dev' field of `struct stat'.  E.g., for drive C: you will get
  12154.      "rw,dev=02".  Note that SUBSTed and JOINed drives get the drive
  12155.      numbers as if SUBST and JOIN were NOT in effect.
  12156.  
  12157. Return Value
  12158. ------------
  12159.  
  12160. This function returns a pointer to an `struct' `mntent', or NULL if
  12161. there are no more drives to report on.
  12162.  
  12163. Example
  12164. -------
  12165.  
  12166.      struct mntent *m;
  12167.      FILE *f;
  12168.      f = setmntent("", "");
  12169.      while ((m = getmntent(f)))
  12170.        printf("Drive %s, name %s\n", m->mnt_dir, m->mnt_fsname);
  12171.      endmntent(f);
  12172.  
  12173. 
  12174. File: libc,  Node: getpagesize,  Next: getpass,  Prev: getmntent,  Up: Alphabetical List
  12175.  
  12176. getpagesize
  12177. ===========
  12178.  
  12179. Syntax
  12180. ------
  12181.  
  12182.      #include <unistd.h>
  12183.      
  12184.      int getpagesize(void);
  12185.  
  12186. Description
  12187. -----------
  12188.  
  12189. Return the size of the native virtual memory page size.
  12190.  
  12191. Return Value
  12192. ------------
  12193.  
  12194. 4096 for the i386 and higher processors.
  12195.  
  12196. 
  12197. File: libc,  Node: getpass,  Next: getpgrp,  Prev: getpagesize,  Up: Alphabetical List
  12198.  
  12199. getpass
  12200. =======
  12201.  
  12202. Syntax
  12203. ------
  12204.  
  12205.      #include <stdlib.h>
  12206.      
  12207.      char * getpass(const char *prompt)
  12208.  
  12209. Description
  12210. -----------
  12211.  
  12212. This function reads up to a Newline (CR or LF) or EOF (Ctrl-D or Ctrl-Z)
  12213. from the standard input, without an echo, after prompting with a
  12214. null-terminated string PROMPT.  It returns the string of at most 8
  12215. characters typed by the user.  Pressing Ctrl-C or Ctrl-Break will cause
  12216. the calling program to `exit(1)'.
  12217.  
  12218. Return Value
  12219. ------------
  12220.  
  12221. A pointer to a static buffer which holds the user's response.  The
  12222. buffer will be overwritten by each new call.  In case of any error in
  12223. the lower I/O routines, a NULL pointer will be returned.
  12224.  
  12225. Example
  12226. -------
  12227.  
  12228.      char *password = getpass("Password: ");
  12229.  
  12230. 
  12231. File: libc,  Node: getpgrp,  Next: getpid,  Prev: getpass,  Up: Alphabetical List
  12232.  
  12233. getpgrp
  12234. =======
  12235.  
  12236. Syntax
  12237. ------
  12238.  
  12239.      #include <unistd.h>
  12240.      
  12241.      int getpgrp(void);
  12242.  
  12243. Description
  12244. -----------
  12245.  
  12246. Gets the process group, which is currently the same as the pid.
  12247.  
  12248. Return Value
  12249. ------------
  12250.  
  12251. The process group.
  12252.  
  12253. 
  12254. File: libc,  Node: getpid,  Next: getpwent,  Prev: getpgrp,  Up: Alphabetical List
  12255.  
  12256. getpid
  12257. ======
  12258.  
  12259. Syntax
  12260. ------
  12261.  
  12262.      #include <unistd.h>
  12263.      
  12264.      int getpid(void);
  12265.  
  12266. Description
  12267. -----------
  12268.  
  12269. Get the process ID, which uniquely identifies each program running on
  12270. the system.
  12271.  
  12272. Return Value
  12273. ------------
  12274.  
  12275. The process ID.
  12276.  
  12277. 
  12278. File: libc,  Node: getpwent,  Next: getpwnam,  Prev: getpid,  Up: Alphabetical List
  12279.  
  12280. getpwent
  12281. ========
  12282.  
  12283. Syntax
  12284. ------
  12285.  
  12286.      #include <pwd.h>
  12287.      
  12288.      struct passwd *getpwent(void);
  12289.  
  12290. Description
  12291. -----------
  12292.  
  12293. This function retrieves the next available password file entry.  For
  12294. MS-DOS, this is simulated by providing exactly one entry:
  12295.  
  12296.      struct passwd {
  12297.        char * pw_name;    /* getlogin() */
  12298.        int    pw_uid;     /* getuid() */
  12299.        int    pw_gid;     /* getgid() */
  12300.        char * pw_dir;     /* "/" or getenv("HOME") */
  12301.        char * pw_shell;   /* "/bin/sh" or getenv("SHELL") */
  12302.      };
  12303.  
  12304. Return Value
  12305. ------------
  12306.  
  12307. The next passwd entry, or `NULL' if there are no more.
  12308.  
  12309. Example
  12310. -------
  12311.  
  12312.      struct passwd *p;
  12313.      setpwent();
  12314.      while ((p = getpwent()) != NULL)
  12315.      {
  12316.        printf("user %s name %s\n", p->pw_name, p->pw_gecos);
  12317.      }
  12318.      endpwent();
  12319.  
  12320. 
  12321. File: libc,  Node: getpwnam,  Next: getpwuid,  Prev: getpwent,  Up: Alphabetical List
  12322.  
  12323. getpwnam
  12324. ========
  12325.  
  12326. Syntax
  12327. ------
  12328.  
  12329.      #include <pwd.h>
  12330.      
  12331.      struct passwd *getpwnam(const char *name);
  12332.  
  12333. Description
  12334. -----------
  12335.  
  12336. This function gets the password file entry matching NAME.  *Note
  12337. getpwent::.
  12338.  
  12339. Return Value
  12340. ------------
  12341.  
  12342. The matching record, or `NULL' if none match.
  12343.  
  12344. 
  12345. File: libc,  Node: getpwuid,  Next: getrusage,  Prev: getpwnam,  Up: Alphabetical List
  12346.  
  12347. getpwuid
  12348. ========
  12349.  
  12350. Syntax
  12351. ------
  12352.  
  12353.      #include <pwd.h>
  12354.      
  12355.      struct passwd *getpwuid(uid_t uid);
  12356.  
  12357. Description
  12358. -----------
  12359.  
  12360. This function gets the password file entry matching UID.  *Note
  12361. getpwent::.
  12362.  
  12363. Return Value
  12364. ------------
  12365.  
  12366. The matching record, or `NULL' if none match.
  12367.  
  12368. 
  12369. File: libc,  Node: getrusage,  Next: gets,  Prev: getpwuid,  Up: Alphabetical List
  12370.  
  12371. getrusage
  12372. =========
  12373.  
  12374. Syntax
  12375. ------
  12376.  
  12377.      #include <sys/time.h>
  12378.      #include <sys/resource.h
  12379.      
  12380.      int getrusage(int who, struct rusage *rusage);
  12381.  
  12382. Description
  12383. -----------
  12384.  
  12385. This function returns information about the running process.  Currently,
  12386. the only field that is computed is this:
  12387.  
  12388.      struct rusage {
  12389.        struct timeval ru_utime;  /* total time used by process */
  12390.      };
  12391.  
  12392. The remainder of the fields are set to zero.
  12393.  
  12394. The WHO parameter must be `RUSAGE_SELF' or `RUSAGE_CHILDREN'.
  12395.  
  12396. Return Value
  12397. ------------
  12398.  
  12399. Zero on success, nonzero on failure.
  12400.  
  12401. Example
  12402. -------
  12403.  
  12404.      struct rusage r;
  12405.      getrusage(RUSAGE_SELF, &r);
  12406.  
  12407. 
  12408. File: libc,  Node: gets,  Next: gettext,  Prev: getrusage,  Up: Alphabetical List
  12409.  
  12410. gets
  12411. ====
  12412.  
  12413. Syntax
  12414. ------
  12415.  
  12416.      #include <stdio.h>
  12417.      
  12418.      char *gets(char *buffer);
  12419.  
  12420. Description
  12421. -----------
  12422.  
  12423. Reads characters from `stdin', storing them in BUFFER, until either end
  12424. of file or a newline is encountered.  If any characters were stored,
  12425. the BUFFER is then `NULL' terminated and its address is returned, else
  12426. `NULL' is returned.
  12427.  
  12428. Return Value
  12429. ------------
  12430.  
  12431. The address of the buffer, or `NULL'.
  12432.  
  12433. Example
  12434. -------
  12435.  
  12436.      char buf[1000];
  12437.      while (gets(buf))
  12438.        puts(buf);
  12439.  
  12440. 
  12441. File: libc,  Node: gettext,  Next: gettextinfo,  Prev: gets,  Up: Alphabetical List
  12442.  
  12443. gettext
  12444. =======
  12445.  
  12446. Syntax
  12447. ------
  12448.  
  12449.      #include <conio.h>
  12450.      
  12451.      int     gettext(int _left, int _top, int _right, int _bottom, void *_destin);
  12452.  
  12453. Description
  12454. -----------
  12455.  
  12456. Retrieve a block of screen characters into a buffer.
  12457.  
  12458. Return Value
  12459. ------------
  12460.  
  12461. 1
  12462.  
  12463. 
  12464. File: libc,  Node: gettextinfo,  Next: gettime,  Prev: gettext,  Up: Alphabetical List
  12465.  
  12466. gettextinfo
  12467. ===========
  12468.  
  12469. Syntax
  12470. ------
  12471.  
  12472.      #include <conio.h>
  12473.      
  12474.      void    gettextinfo(struct text_info *_r);
  12475.  
  12476. Description
  12477. -----------
  12478.  
  12479. This function returns the parameters of the current window on the
  12480. screen.  The return structure is this:
  12481.  
  12482.      struct text_info {
  12483.          unsigned char winleft;
  12484.          unsigned char wintop;
  12485.          unsigned char winright;
  12486.          unsigned char winbottom;
  12487.          unsigned char attribute;
  12488.          unsigned char normattr;
  12489.          unsigned char currmode;
  12490.          unsigned char screenheight;
  12491.          unsigned char screenwidth;
  12492.          unsigned char curx;
  12493.          unsigned char cury;
  12494.      };
  12495.  
  12496. The `normattr' field is the text attribute which was in effect before
  12497. the program started.
  12498.  
  12499. 
  12500. File: libc,  Node: gettime,  Next: gettimeofday,  Prev: gettextinfo,  Up: Alphabetical List
  12501.  
  12502. gettime
  12503. =======
  12504.  
  12505. Syntax
  12506. ------
  12507.  
  12508.      #include <dos.h>
  12509.      
  12510.      void gettime(struct time *);
  12511.  
  12512. Description
  12513. -----------
  12514.  
  12515. This function gets the current time.  The return structure is as
  12516. follows:
  12517.  
  12518.      struct time {
  12519.        unsigned char ti_min;
  12520.        unsigned char ti_hour;
  12521.        unsigned char ti_hund;
  12522.        unsigned char ti_sec;
  12523.      };
  12524.  
  12525. *Note settime::. *Note getdate::.
  12526.  
  12527. Return Value
  12528. ------------
  12529.  
  12530. None.
  12531.  
  12532. Example
  12533. -------
  12534.  
  12535.      struct time t;
  12536.      gettime(&t);
  12537.  
  12538. 
  12539. File: libc,  Node: gettimeofday,  Next: getuid,  Prev: gettime,  Up: Alphabetical List
  12540.  
  12541. gettimeofday
  12542. ============
  12543.  
  12544. Syntax
  12545. ------
  12546.  
  12547.      #include <sys/time.h>
  12548.      
  12549.      int gettimeofday(struct timeval *tp, struct timezone *tzp);
  12550.  
  12551. Description
  12552. -----------
  12553.  
  12554. Gets the current GMT time and the local timezone information.  The
  12555. return structures are as follows:
  12556.  
  12557.      struct timeval {
  12558.        long tv_sec;  /* seconds since 00:00:00 GMT 1/1/1970 */
  12559.        long tv_usec; /* microseconds */
  12560.      };
  12561.      struct timezone {
  12562.        int tz_minuteswest; /* west of GMT */
  12563.        int tz_dsttime;     /* set if daylight saving time in affect */
  12564.      };
  12565.  
  12566. If either TP or TZP are `NULL', that information is not provided.
  12567.  
  12568. *Note settimeofday::.
  12569.  
  12570. Return Value
  12571. ------------
  12572.  
  12573. Zero on success, nonzero on failure.
  12574.  
  12575. 
  12576. File: libc,  Node: getuid,  Next: getw,  Prev: gettimeofday,  Up: Alphabetical List
  12577.  
  12578. getuid
  12579. ======
  12580.  
  12581. Syntax
  12582. ------
  12583.  
  12584.      #include <unistd.h>
  12585.      
  12586.      int getuid(void);
  12587.  
  12588. Description
  12589. -----------
  12590.  
  12591. Returns the user ID.
  12592.  
  12593. Return Value
  12594. ------------
  12595.  
  12596. 42
  12597.  
  12598. 
  12599. File: libc,  Node: getw,  Next: getwd,  Prev: getuid,  Up: Alphabetical List
  12600.  
  12601. getw
  12602. ====
  12603.  
  12604. Syntax
  12605. ------
  12606.  
  12607.      #include <stdio.h>
  12608.      
  12609.      int getw(FILE *file);
  12610.  
  12611. Description
  12612. -----------
  12613.  
  12614. Reads a single binary word in native format from FILE.
  12615.  
  12616. *Note putw::.
  12617.  
  12618. Return Value
  12619. ------------
  12620.  
  12621. The value read, or `EOF' for end-of-file or error.  Since `EOF' is a
  12622. valid integer, you should use `feof' or `ferror' to detect this
  12623. situation.
  12624.  
  12625. Example
  12626. -------
  12627.  
  12628.      int i = getw(stdin);
  12629.  
  12630. 
  12631. File: libc,  Node: getwd,  Next: getxkey,  Prev: getw,  Up: Alphabetical List
  12632.  
  12633. getwd
  12634. =====
  12635.  
  12636. Syntax
  12637. ------
  12638.  
  12639.      #include <unistd.h>
  12640.      
  12641.      char *getwd(char *buffer);
  12642.  
  12643. Description
  12644. -----------
  12645.  
  12646. Get the current directory and put it in BUFFER.  The return value
  12647. includes the drive specifier.
  12648.  
  12649. Return Value
  12650. ------------
  12651.  
  12652. BUFFER is returned.
  12653.  
  12654. Example
  12655. -------
  12656.  
  12657.      char buf[PATH_MAX];
  12658.      getwd(buf);
  12659.  
  12660. 
  12661. File: libc,  Node: getxkey,  Next: glob,  Prev: getwd,  Up: Alphabetical List
  12662.  
  12663. getxkey
  12664. =======
  12665.  
  12666. Syntax
  12667. ------
  12668.  
  12669.      #include <pc.h>
  12670.      #include <keys.h>
  12671.      
  12672.      int getxkey(void);
  12673.  
  12674. Description
  12675. -----------
  12676.  
  12677. Waits for the user to press one key, then returns that key.  Alt-key
  12678. combinations have 0x100 added to them, and extended keys have 0x200
  12679. added to them.
  12680.  
  12681. The file `keys.h' has symbolic names for many of the keys.
  12682.  
  12683. *Note getkey::.
  12684.  
  12685. Return Value
  12686. ------------
  12687.  
  12688. The key pressed.
  12689.  
  12690. Example
  12691. -------
  12692.  
  12693.      while (getxkey() != K_EEnd)
  12694.        do_something();
  12695.  
  12696. 
  12697. File: libc,  Node: glob,  Next: globfree,  Prev: getxkey,  Up: Alphabetical List
  12698.  
  12699. glob
  12700. ====
  12701.  
  12702. Syntax
  12703. ------
  12704.  
  12705.      #include <glob.h>
  12706.      
  12707.      int  glob(const char *_pattern, int _flags,
  12708.                int (*_errfunc)(const char *_epath, int _eerrno), glob_t *_pglob);
  12709.  
  12710. Description
  12711. -----------
  12712.  
  12713. This function performs command-line wildcard expansion.  The pattern to
  12714. be expanded is passed as PATTERN, and a pointer to a structure is
  12715. passed via _PGLOB.  This structure is like this:
  12716.  
  12717.      typedef struct {
  12718.        size_t gl_pathc;
  12719.        char **gl_pathv;
  12720.        size_t gl_offs;
  12721.      } glob_t;
  12722.  
  12723. The `gl_pathc' and `gl_pathv' fields define a list of matches.  The
  12724. `gl_offs' field indicates that the list should be offset.
  12725.  
  12726. The structure is filled in with information about the files that
  12727. matched the wildcard.  Values for _FLAGS are as follows:
  12728.  
  12729. `GLOB_APPEND'
  12730.      Append matches to a pre-existing structure.
  12731.  
  12732. `GLOB_DOOFFS'
  12733.      Skip _pglob->gl_offs entries in gl_pathv.
  12734.  
  12735. `GLOB_ERR'
  12736.      Stop when an unreadable directory is encountered.
  12737.  
  12738. `GLOB_MARK'
  12739.      Append a slash to each pathname that is a directory.
  12740.  
  12741. `GLOB_NOCHECK'
  12742.      If no matches are found, return the pattern itself as the only
  12743.      match.
  12744.  
  12745. `GLOB_NOESCAPE'
  12746.      Disable blackslash as an escape character.
  12747.  
  12748. `GLOB_NOSORT'
  12749.      Do not sort the returned list.
  12750.  
  12751. Return Value
  12752. ------------
  12753.  
  12754. Zero on success.
  12755.  
  12756. 
  12757. File: libc,  Node: globfree,  Next: gmtime,  Prev: glob,  Up: Alphabetical List
  12758.  
  12759. globfree
  12760. ========
  12761.  
  12762. Syntax
  12763. ------
  12764.  
  12765.      #include <glob.h>
  12766.      
  12767.      void globfree(glob_t *_pglob);
  12768.  
  12769. Description
  12770. -----------
  12771.  
  12772. Frees the memory associated with `_pglob'.
  12773.  
  12774. 
  12775. File: libc,  Node: gmtime,  Next: _go32_conventional_mem_selector,  Prev: globfree,  Up: Alphabetical List
  12776.  
  12777. gmtime
  12778. ======
  12779.  
  12780. Syntax
  12781. ------
  12782.  
  12783.      #include <time.h>
  12784.      
  12785.      struct tm *gmtime(const time_t *tod);
  12786.  
  12787. Description
  12788. -----------
  12789.  
  12790. Converts the time represented by TOD into a structure.
  12791.  
  12792. The return structure has this format:
  12793.  
  12794.      struct tm {
  12795.        int    tm_sec;    /* seconds after the minute [0-60] */
  12796.        int    tm_min;    /* minutes after the hour [0-59] */
  12797.        int    tm_hour;   /* hours since midnight [0-23] */
  12798.        int    tm_mday;   /* day of the month [1-31] */
  12799.        int    tm_mon;    /* months since January [0-11] */
  12800.        int    tm_year;   /* years since 1900 */
  12801.        int    tm_wday;   /* days since Sunday [0-6] */
  12802.        int    tm_yday;   /* days since January 1 [0-365] */
  12803.        int    tm_isdst;  /* Daylight Savings Time flag */
  12804.        long   tm_gmtoff; /* offset from GMT in seconds */
  12805.        char * tm_zone;   /* timezone abbreviation */
  12806.      };
  12807.  
  12808. Return Value
  12809. ------------
  12810.  
  12811. A pointer to a static structure which is overridden with each call.
  12812.  
  12813. Example
  12814. -------
  12815.  
  12816.      time_t x;
  12817.      struct tm *t;
  12818.      time(&x);
  12819.      t = gmtime(&t);
  12820.  
  12821. 
  12822. File: libc,  Node: _go32_conventional_mem_selector,  Next: _go32_dpmi_allocate_dos_memory,  Prev: gmtime,  Up: Alphabetical List
  12823.  
  12824. _go32_conventional_mem_selector
  12825. ===============================
  12826.  
  12827. Syntax
  12828. ------
  12829.  
  12830.      #include <go32.h>
  12831.      
  12832.      u_short _go32_conventional_mem_selector();
  12833.  
  12834. Description
  12835. -----------
  12836.  
  12837. This function returns a selector which has a physical base address
  12838. corresponding to the beginning of conventional memory.  This selector
  12839. can be used as a parameter to `movedata' (*note movedata::.) to
  12840. manipulate memory in the conventional address space.
  12841.  
  12842. Return Value
  12843. ------------
  12844.  
  12845. The selector.
  12846.  
  12847. Example
  12848. -------
  12849.  
  12850.      short blank_row_buf[ScreenCols()];
  12851.      /* scroll screen */
  12852.      movedata(_go32_conventional_mem_selector(), 0xb8000 + ScreenCols()*2,
  12853.               _go32_conventional_mem_selector(), 0xb8000,
  12854.               ScreenCols() * (ScreenRows()-1) * 2);
  12855.      /* fill last row */
  12856.      movedata(_go32_my_ds, (int)blank_row_buf,
  12857.               _go32_conventional_mem_selector(),
  12858.                  0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  12859.                ScreenCols() * 2);
  12860.  
  12861. 
  12862. File: libc,  Node: _go32_dpmi_allocate_dos_memory,  Next: _go32_dpmi_allocate_iret_wrapper,  Prev: _go32_conventional_mem_selector,  Up: Alphabetical List
  12863.  
  12864. _go32_dpmi_allocate_dos_memory
  12865. ==============================
  12866.  
  12867. Syntax
  12868. ------
  12869.  
  12870.      #include <dpmi.h>
  12871.      
  12872.      int _go32_dpmi_allocate_dos_memory(_go32_dpmi_seginfo *info);
  12873.  
  12874. Description
  12875. -----------
  12876.  
  12877. *Note DPMI Overview::
  12878.  
  12879. Allocate a part of the conventional memory area (the first 640K).  Set
  12880. the `size' field of INFO to the number of paragraphs requested (this is
  12881. (size in bytes + 15)/16), then call.  The `rm_segment' field of INFO
  12882. contains the segment of the allocated memory.
  12883.  
  12884. The memory may be resized with `_go32_dpmi_resize_dos_memory' and must
  12885. be freed with `_go32_dpmi_free_dos_memory'.
  12886.  
  12887. If there isn't enough memory in the system, the `size' field of INFO
  12888. has the largest available size, and an error is returned.
  12889.  
  12890. *Note dosmemput:: *Note dosmemget::
  12891.  
  12892. Return Value
  12893. ------------
  12894.  
  12895. Zero on success, nonzero on failure.
  12896.  
  12897. Example
  12898. -------
  12899.  
  12900.      _go32_dpmi_seginfo info;
  12901.      info.size = (want_size+15) / 16;
  12902.      _go32_dpmi_allocate_dos_memory(&info);
  12903.      dosmemput(buffer, want_size, info.rm_segment*16);
  12904.      _go32_dpmi_free_dos_memory(&info);
  12905.  
  12906. 
  12907. File: libc,  Node: _go32_dpmi_allocate_iret_wrapper,  Next: _go32_dpmi_allocate_real_mode_callback_iret,  Prev: _go32_dpmi_allocate_dos_memory,  Up: Alphabetical List
  12908.  
  12909. _go32_dpmi_allocate_iret_wrapper
  12910. ================================
  12911.  
  12912. Syntax
  12913. ------
  12914.  
  12915.      #include <dpmi.h>
  12916.      
  12917.      int _go32_dpmi_allocate_iret_wrapper(_go32_dpmi_seginfo *info);
  12918.  
  12919. Description
  12920. -----------
  12921.  
  12922. *Note DPMI Overview::
  12923.  
  12924. This function creates a small assembler function that handles the
  12925. overhead of servicing an interrupt.  To use, put the address of your
  12926. servicing function in the `pm_offset' field of INFO and call this
  12927. function.  The `pm_field' will get replaced with the address of the
  12928. wrapper function, which you pass to both
  12929. `_go32_dpmi_set_protected_mode_interrupt_vector' and
  12930. `_go32_dpmi_free_iret_wrapper'.
  12931.  
  12932. *Note _go32_dpmi_set_protected_mode_interrupt_vector:: *Note
  12933. _go32_dpmi_free_iret_wrapper::
  12934.  
  12935. Return Value
  12936. ------------
  12937.  
  12938. Zero on success, nonzero on failure.
  12939.  
  12940. Example
  12941. -------
  12942.  
  12943.      _go32_dpmi_seginfo info;
  12944.      info.pm_offset = my_handler;
  12945.      _go32_dpmi_allocate_iret_wrapper(&info);
  12946.      _go32_dpmi_set_protected_mode_interrupt_handler(0x75, &info);
  12947.      ...
  12948.      _go32_dpmi_free_iret_wrapper(&info);
  12949.  
  12950. 
  12951. File: libc,  Node: _go32_dpmi_allocate_real_mode_callback_iret,  Next: _go32_dpmi_allocate_real_mode_callback_retf,  Prev: _go32_dpmi_allocate_iret_wrapper,  Up: Alphabetical List
  12952.  
  12953. _go32_dpmi_allocate_real_mode_callback_iret
  12954. ===========================================
  12955.  
  12956. Syntax
  12957. ------
  12958.  
  12959.      #include <dpmi.h>
  12960.      
  12961.      int _go32_dpmi_allocate_real_mode_callback_iret(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  12962.  
  12963. Description
  12964. -----------
  12965.  
  12966. *Note DPMI Overview::
  12967.  
  12968. This function allocates a "real-mode callback".  Fill in the
  12969. `pm_offset' field of INFO and call this function.  It will fill in the
  12970. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  12971. calls the real-mode address, your function gets called.  The registers
  12972. in affect will be stored in REGS, which should be a global, and will be
  12973. passed to your function.  Any changes in REGS will be reflected back
  12974. into real mode.  A wrapper will be added to your function to simulate
  12975. the effects of an `iret' instruction, so this function is useful for
  12976. trapping real-mode software interrupts (like 0x1b - `Ctrl-Break' hit).
  12977.  
  12978. Return Value
  12979. ------------
  12980.  
  12981. Zero on success, nonzero on failure.
  12982.  
  12983. Example
  12984. -------
  12985.  
  12986.      _go32_dpmi_registers regs;
  12987.      
  12988.      my_handler(_go32_dpmi_registers *r)
  12989.      {
  12990.        r.d.eax = 4;
  12991.      }
  12992.      
  12993.      setup()
  12994.      {
  12995.        _go32_dpmi_seginfo info;
  12996.        _go32_dpmi_seginfo old_vector;
  12997.        _go32_dpmi_get_real_mode_interrupt_vector(0x84, &old_vector);
  12998.        info.pm_offset = my_handler;
  12999.        _go32_dpmi_allocate_real_mode_callback_iret(&info, ®s);
  13000.        _go32_dpmi_set_real_mode_interrupt_vector(0x84, &info);
  13001.        do_stuff();
  13002.        _go32_dpmi_set_real_mode_interrupt_vector(0x84, &old_vector);
  13003.        _go32_dpmi_free_real_mode_callback(&info);
  13004.      }
  13005.  
  13006. 
  13007. File: libc,  Node: _go32_dpmi_allocate_real_mode_callback_retf,  Next: _go32_dpmi_chain_protected_mode_interrupt_vector,  Prev: _go32_dpmi_allocate_real_mode_callback_iret,  Up: Alphabetical List
  13008.  
  13009. _go32_dpmi_allocate_real_mode_callback_retf
  13010. ===========================================
  13011.  
  13012. Syntax
  13013. ------
  13014.  
  13015.      #include <dpmi.h>
  13016.      
  13017.      int _go32_dpmi_allocate_real_mode_callback_retf(_go32_dpmi_seginfo *info, _go32_dpmi_registers *regs);
  13018.  
  13019. Description
  13020. -----------
  13021.  
  13022. *Note DPMI Overview::
  13023.  
  13024. This function allocates a "real-mode callback".  Fill in the
  13025. `pm_offset' field of INFO and call this function.  It will fill in the
  13026. `rm_segment' and `rm_offset' fields.  Any time a real-mode program
  13027. calls the real-mode address, your function gets called.  The registers
  13028. in affect will be stored in REGS, which should be a global, and will be
  13029. passed to your function.  Any changes in REGS will be reflected back
  13030. into real mode.  A wrapper will be added to your function to simulate
  13031. the effects of a far return, such as the callback for the packet driver
  13032. receiver.
  13033.  
  13034. Return Value
  13035. ------------
  13036.  
  13037. Zero on success, nonzero on failure.
  13038.  
  13039. Example
  13040. -------
  13041.  
  13042. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  13043.  
  13044. 
  13045. File: libc,  Node: _go32_dpmi_chain_protected_mode_interrupt_vector,  Next: _go32_dpmi_free_dos_memory,  Prev: _go32_dpmi_allocate_real_mode_callback_retf,  Up: Alphabetical List
  13046.  
  13047. _go32_dpmi_chain_protected_mode_interrupt_vector
  13048. ================================================
  13049.  
  13050. Syntax
  13051. ------
  13052.  
  13053.      #include <dpmi.h>
  13054.      
  13055.      int _go32_dpmi_chain_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  13056.  
  13057. Description
  13058. -----------
  13059.  
  13060. *Note DPMI Overview::
  13061.  
  13062. This function is used to chain a protected mode interrupt.  It will
  13063. build a suitable wrapper that will call your function and then jump to
  13064. the next handler.  Your function need not perform any special handling.
  13065.  
  13066. *Warning!* Because of the way DPMI works, you may *not* `longjmp' out
  13067. of an interrupt handler or perform any system calls (such as `printf')
  13068. from within an interrupt handler.
  13069.  
  13070. Return Value
  13071. ------------
  13072.  
  13073. Zero on success, nonzero on failure.
  13074.  
  13075. Example
  13076. -------
  13077.  
  13078. *Note _go32_dpmi_set_protected_mode_interrupt_vector::
  13079.  
  13080. 
  13081. File: libc,  Node: _go32_dpmi_free_dos_memory,  Next: _go32_dpmi_free_iret_wrapper,  Prev: _go32_dpmi_chain_protected_mode_interrupt_vector,  Up: Alphabetical List
  13082.  
  13083. _go32_dpmi_free_dos_memory
  13084. ==========================
  13085.  
  13086. Syntax
  13087. ------
  13088.  
  13089.      #include <dpmi.h>
  13090.      
  13091.      int _go32_dpmi_free_dos_memory(_go32_dpmi_seginfo *info);
  13092.  
  13093. Description
  13094. -----------
  13095.  
  13096. *Note DPMI Overview::
  13097.  
  13098. This function frees the conventional memory allocated by
  13099. `_go32_dpmi_allocate_real_mode_memory'.  You should pass it the same
  13100. structure as was used to allocate it.
  13101.  
  13102. Return Value
  13103. ------------
  13104.  
  13105. Zero on success, nonzero on failure.
  13106.  
  13107. Example
  13108. -------
  13109.  
  13110.      _go32_dpmi_seginfo info;
  13111.      info.size = 100;
  13112.      _go32_dpmi_allocate_dos_memory(&info);
  13113.      _go32_dpmi_free_dos_memory(&info);
  13114.  
  13115. 
  13116. File: libc,  Node: _go32_dpmi_free_iret_wrapper,  Next: _go32_dpmi_free_real_mode_callback,  Prev: _go32_dpmi_free_dos_memory,  Up: Alphabetical List
  13117.  
  13118. _go32_dpmi_free_iret_wrapper
  13119. ============================
  13120.  
  13121. Syntax
  13122. ------
  13123.  
  13124.      #include <dpmi.h>
  13125.      
  13126.      int _go32_dpmi_free_iret_wrapper(_go32_dpmi_seginfo *info);
  13127.  
  13128. Description
  13129. -----------
  13130.  
  13131. *Note DPMI Overview::
  13132.  
  13133. This function frees the memory used by the wrapper created by
  13134. `_go32_dpmi_allocate_iret_wrapper'.  You should not free a wrapper that
  13135. is still in use.
  13136.  
  13137. Return Value
  13138. ------------
  13139.  
  13140. Zero on success, nonzero on failure.
  13141.  
  13142. Example
  13143. -------
  13144.  
  13145. *Note _go32_dpmi_allocate_iret_wrapper::
  13146.  
  13147. 
  13148. File: libc,  Node: _go32_dpmi_free_real_mode_callback,  Next: _go32_dpmi_get_free_memory_information,  Prev: _go32_dpmi_free_iret_wrapper,  Up: Alphabetical List
  13149.  
  13150. _go32_dpmi_free_real_mode_callback
  13151. ==================================
  13152.  
  13153. Syntax
  13154. ------
  13155.  
  13156.      #include <dpmi.h>
  13157.      
  13158.      int _go32_dpmi_free_real_mode_callback(_go32_dpmi_seginfo *info);
  13159.  
  13160. Description
  13161. -----------
  13162.  
  13163. *Note DPMI Overview::
  13164.  
  13165. This function frees the real-mode callbacks and wrappers allocated by
  13166. `_go32_dpmi_allocate_real_mode_callback_iret' and
  13167. `_go32_dpmi_allocate_real_mode_callback_retf'.
  13168.  
  13169. Return Value
  13170. ------------
  13171.  
  13172. Zero on success, nonzero on failure.
  13173.  
  13174. Example
  13175. -------
  13176.  
  13177. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  13178.  
  13179. 
  13180. File: libc,  Node: _go32_dpmi_get_free_memory_information,  Next: _go32_dpmi_get_protected_mode_interrupt_vector,  Prev: _go32_dpmi_free_real_mode_callback,  Up: Alphabetical List
  13181.  
  13182. _go32_dpmi_get_free_memory_information
  13183. ======================================
  13184.  
  13185. Syntax
  13186. ------
  13187.  
  13188.      #include <dpmi.h
  13189.      
  13190.      int _go32_dpmi_get_free_memory_information(_go32_dpmi_meminfo *info);
  13191.  
  13192. Description
  13193. -----------
  13194.  
  13195. This function fills in the following structure:
  13196.  
  13197.      typedef struct {
  13198.        u_long available_memory;
  13199.        u_long available_pages;
  13200.        u_long available_lockable_pages;
  13201.        u_long linear_space;
  13202.        u_long unlocked_pages;
  13203.        u_long available_physical_pages;
  13204.        u_long total_physical_pages;
  13205.        u_long free_linear_space;
  13206.        u_long max_pages_in_paging_file;
  13207.        u_long reserved[3];
  13208.      } _go32_dpmi_meminfo;
  13209.  
  13210. The only field that is guaranteed to have useful data is
  13211. `available_memory'.  Any unavailable field has -1 in it.
  13212.  
  13213. Return Value
  13214. ------------
  13215.  
  13216. Zero on success, nonzero on failure.
  13217.  
  13218. Example
  13219. -------
  13220.  
  13221.      int phys_mem_left()
  13222.      {
  13223.        _go32_dpmi_meminfo info;
  13224.        _go32_dpmi_get_free_memory_information(&info);
  13225.        if (info.available_physical_pages != -1)
  13226.          return info.available_physical_pages * 4096;
  13227.        return info.available_memory;
  13228.      }
  13229.  
  13230. 
  13231. File: libc,  Node: _go32_dpmi_get_protected_mode_interrupt_vector,  Next: _go32_dpmi_get_real_mode_interrupt_vector,  Prev: _go32_dpmi_get_free_memory_information,  Up: Alphabetical List
  13232.  
  13233. _go32_dpmi_get_protected_mode_interrupt_vector
  13234. ==============================================
  13235.  
  13236. Syntax
  13237. ------
  13238.  
  13239.      #include <dpmi.h>
  13240.      
  13241.      int _go32_dpmi_get_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  13242.  
  13243. Description
  13244. -----------
  13245.  
  13246. *Note DPMI Overview::
  13247.  
  13248. This function puts the selector and offset of the specified interrupt
  13249. vector into the `pm_selector' and `pm_offset' fields of INFO.  This
  13250. structure can be saved and later passed to
  13251. `_go32_dpmi_get_protected_mode_interrupt_vector' to restore a vector.
  13252.  
  13253. Return Value
  13254. ------------
  13255.  
  13256. Zero on success, nonzero on failure.
  13257.  
  13258. Example
  13259. -------
  13260.  
  13261. *Note _go32_dpmi_set_protected_mode_interrupt_vector::
  13262.  
  13263. 
  13264. File: libc,  Node: _go32_dpmi_get_real_mode_interrupt_vector,  Next: _go32_dpmi_lock_code,  Prev: _go32_dpmi_get_protected_mode_interrupt_vector,  Up: Alphabetical List
  13265.  
  13266. _go32_dpmi_get_real_mode_interrupt_vector
  13267. =========================================
  13268.  
  13269. Syntax
  13270. ------
  13271.  
  13272.      #include <dpmi.h>
  13273.      
  13274.      int _go32_dpmi_get_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  13275.  
  13276. Description
  13277. -----------
  13278.  
  13279. *Note DPMI Overview::
  13280.  
  13281. This function gets the real-mode interrupt vector specified into the
  13282. address in the `rm_segment' and `rm_offset' fields in INFO.
  13283.  
  13284. Return Value
  13285. ------------
  13286.  
  13287. Zero on success, nonzero on failure.
  13288.  
  13289. Example
  13290. -------
  13291.  
  13292. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  13293.  
  13294. 
  13295. File: libc,  Node: _go32_dpmi_lock_code,  Next: _go32_dpmi_lock_data,  Prev: _go32_dpmi_get_real_mode_interrupt_vector,  Up: Alphabetical List
  13296.  
  13297. _go32_dpmi_lock_code
  13298. ====================
  13299.  
  13300. Syntax
  13301. ------
  13302.  
  13303.      #include <dpmi.h>
  13304.      
  13305.      int _go32_dpmi_lock_code( void *lockaddr, unsigned long locksize);
  13306.  
  13307. Description
  13308. -----------
  13309.  
  13310. Locks the given region of code, starting at LOCKADDR for LOCKSIZE
  13311. bytes.  LOCKADDR is a regular pointer in your program, such as the
  13312. address of a function.
  13313.  
  13314. Example
  13315. -------
  13316.  
  13317.  
  13318.      void my_handler()
  13319.      {
  13320.      }
  13321.      
  13322.      void lock_my_handler()
  13323.      {
  13324.        _go32_dpmi_lock_code(my_handler, (unsigned long)(lock_my_handler - my_handler));
  13325.      }
  13326.  
  13327. 
  13328. File: libc,  Node: _go32_dpmi_lock_data,  Next: _go32_dpmi_remaining_physical_memory,  Prev: _go32_dpmi_lock_code,  Up: Alphabetical List
  13329.  
  13330. _go32_dpmi_lock_data
  13331. ====================
  13332.  
  13333. Syntax
  13334. ------
  13335.  
  13336.      #include <dpmi.h>
  13337.      
  13338.      int _go32_dpmi_lock_data( void *lockaddr, unsigned long locksize);
  13339.  
  13340. Description
  13341. -----------
  13342.  
  13343. Locks the given region of code, starting at LOCKADDR for LOCKSIZE
  13344. bytes.  LOCKADDR is a regular pointer in your program, such as the
  13345. address of a variable.
  13346.  
  13347. Example
  13348. -------
  13349.  
  13350.  
  13351.      int semaphore=0;
  13352.      
  13353.      void lock_my_handler()
  13354.      {
  13355.        _go32_dpmi_lock_data(&semaphore, 4);
  13356.      }
  13357.  
  13358. 
  13359. File: libc,  Node: _go32_dpmi_remaining_physical_memory,  Next: _go32_dpmi_remaining_virtual_memory,  Prev: _go32_dpmi_lock_data,  Up: Alphabetical List
  13360.  
  13361. _go32_dpmi_remaining_physical_memory
  13362. ====================================
  13363.  
  13364. Syntax
  13365. ------
  13366.  
  13367.      #include <dpmi.h>
  13368.      
  13369.      unsigned long _go32_dpmi_remaining_physical_memory(void);
  13370.  
  13371. Description
  13372. -----------
  13373.  
  13374. Returns the amount of physical memory that is still available in the
  13375. system.
  13376.  
  13377. Return Value
  13378. ------------
  13379.  
  13380. The amount in bytes.
  13381.  
  13382. 
  13383. File: libc,  Node: _go32_dpmi_remaining_virtual_memory,  Next: _go32_dpmi_resize_dos_memory,  Prev: _go32_dpmi_remaining_physical_memory,  Up: Alphabetical List
  13384.  
  13385. _go32_dpmi_remaining_virtual_memory
  13386. ===================================
  13387.  
  13388. Syntax
  13389. ------
  13390.  
  13391.      #include <dpmi.h>
  13392.      
  13393.      unsigned long _go32_dpmi_remaining_virtual_memory(void);
  13394.  
  13395. Description
  13396. -----------
  13397.  
  13398. Returns the amount of virtual memory that is still available in the
  13399. system.
  13400.  
  13401. Return Value
  13402. ------------
  13403.  
  13404. The amount in bytes.
  13405.  
  13406. 
  13407. File: libc,  Node: _go32_dpmi_resize_dos_memory,  Next: _go32_dpmi_set_protected_mode_interrupt_vector,  Prev: _go32_dpmi_remaining_virtual_memory,  Up: Alphabetical List
  13408.  
  13409. _go32_dpmi_resize_dos_memory
  13410. ============================
  13411.  
  13412. Syntax
  13413. ------
  13414.  
  13415.      #include <dpmi.h>
  13416.      
  13417.      int _go32_dpmi_resize_dos_memory(_go32_dpmi_seginfo *info);
  13418.  
  13419. Description
  13420. -----------
  13421.  
  13422. *Note DPMI Overview::
  13423.  
  13424. The INFO structure is the same one used to allocate the memory.  Fill
  13425. in a new value for `size' and call this function.  If there is not
  13426. enough memory to satisfy the request, the largest size is filled in to
  13427. the `size' field, the memory is not resized, and this function fails.
  13428.  
  13429. Return Value
  13430. ------------
  13431.  
  13432. Zero on success, nonzero on failure.
  13433.  
  13434. Example
  13435. -------
  13436.  
  13437.      _go32_dpmi_seginfo info;
  13438.      info.size = 10;
  13439.      _go32_dpmi_allocate_dos_memory(&info);
  13440.      info.size = 20;
  13441.      _go32_dpmi_resize_dos_memory(&info);
  13442.      _go32_dpmi_free_dos_memory(&info);
  13443.  
  13444. 
  13445. File: libc,  Node: _go32_dpmi_set_protected_mode_interrupt_vector,  Next: _go32_dpmi_set_real_mode_interrupt_vector,  Prev: _go32_dpmi_resize_dos_memory,  Up: Alphabetical List
  13446.  
  13447. _go32_dpmi_set_protected_mode_interrupt_vector
  13448. ==============================================
  13449.  
  13450. Syntax
  13451. ------
  13452.  
  13453.      #include <dpmi.h>
  13454.      
  13455.      int _go32_dpmi_set_protected_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  13456.  
  13457. Description
  13458. -----------
  13459.  
  13460. *Note DPMI Overview::
  13461.  
  13462. This function sets the protected mode interrupt vector specified to
  13463. point to the given function.  The `pm_offset' and `pm_selector' fields
  13464. of INFO must be filled in (*note _go32_my_cs::.).  The following should
  13465. be noted:
  13466.  
  13467.    *  You may not `longjmp' out of an interrupt handler.
  13468.  
  13469.    *  You may not make any function calls that require system calls,
  13470.      such as `printf'.
  13471.  
  13472.    *  This function will not wrap the handler for you.  The
  13473.      `_go32_dpmi_allocate_iret_wrapper' and
  13474.      `_go32_dpmi_chain_protected_mode_interrupt_vector' functions can
  13475.      wrap your function if you want.
  13476.  
  13477.    *  You must set the pm_selector field of INFO.  Use `_go32_my_cs' to
  13478.      get a selector valid for your functions.
  13479.  
  13480. Return Value
  13481. ------------
  13482.  
  13483. Zero on success, nonzero on failure.
  13484.  
  13485. Example
  13486. -------
  13487.  
  13488.      volatile int tics = 0;
  13489.      
  13490.      timer_handler()
  13491.      {
  13492.        tics++;
  13493.      }
  13494.      
  13495.      int main()
  13496.      {
  13497.        _go32_dpmi_seginfo old_handler, new_handler;
  13498.      
  13499.        printf("grabbing timer interrupt\n");
  13500.        _go32_dpmi_get_protected_mode_interrupt_vector(8, &old_handler);
  13501.      
  13502.        new_handler.pm_offset = (int)tic_handler;
  13503.        new_handler.pm_selector = _go32_my_cs();
  13504.        _go32_dpmi_chain_protected_mode_interrupt_vector(8, &new_handler);
  13505.      
  13506.        getkey();
  13507.      
  13508.        printf("releasing timer interrupt\n");
  13509.        _go32_dpmi_set_protected_mode_interrupt_vector(8, &old_handler);
  13510.      
  13511.        return 0;
  13512.      }
  13513.  
  13514. 
  13515. File: libc,  Node: _go32_dpmi_set_real_mode_interrupt_vector,  Next: _go32_dpmi_simulate_fcall,  Prev: _go32_dpmi_set_protected_mode_interrupt_vector,  Up: Alphabetical List
  13516.  
  13517. _go32_dpmi_set_real_mode_interrupt_vector
  13518. =========================================
  13519.  
  13520. Syntax
  13521. ------
  13522.  
  13523.      #include <dpmi.h>
  13524.      
  13525.      int _go32_dpmi_set_real_mode_interrupt_vector(int vector, _go32_dpmi_seginfo *info);
  13526.  
  13527. Description
  13528. -----------
  13529.  
  13530. *Note DPMI Overview::
  13531.  
  13532. This function sets the real-mode interrupt vector specified to point to
  13533. the address in the `rm_segment' and `rm_offset' fields in INFO.
  13534.  
  13535. Return Value
  13536. ------------
  13537.  
  13538. Zero on success, nonzero on failure.
  13539.  
  13540. Example
  13541. -------
  13542.  
  13543. *Note _go32_dpmi_allocate_real_mode_callback_iret::
  13544.  
  13545. 
  13546. File: libc,  Node: _go32_dpmi_simulate_fcall,  Next: _go32_dpmi_simulate_fcall_iret,  Prev: _go32_dpmi_set_real_mode_interrupt_vector,  Up: Alphabetical List
  13547.  
  13548. _go32_dpmi_simulate_fcall
  13549. =========================
  13550.  
  13551. Syntax
  13552. ------
  13553.  
  13554.      #include <dpmi.h>
  13555.      
  13556.      int _go32_dpmi_simulate_fcall(_go32_dpmi_registers *regs);
  13557.  
  13558. Description
  13559. -----------
  13560.  
  13561. *Note DPMI Overview::
  13562.  
  13563. This function simulates a real-mode far call to a function that returns
  13564. with a far return.  The registers are set up from REGS, including `CS'
  13565. and `IP', which indicate the address of the call.  Any registers the
  13566. function modifies are reflected in REGS on return.
  13567.  
  13568. If `SS' and `SP' are both zero, a small temporary stack is used when in
  13569. real mode.  If not, they are used AS IS.  It's a good idea to use
  13570. `memset' to initialize the register structure before using it.
  13571.  
  13572. Return Value
  13573. ------------
  13574.  
  13575. Zero on success, nonzero on failure.
  13576.  
  13577. Example
  13578. -------
  13579.  
  13580.      _go32_dpmi_registers r;
  13581.      r.x.ax = 47;
  13582.      r.x.cs = some_segment;
  13583.      r.x.ip = some_offset;
  13584.      r.x.ss = r.x.sp = 0;
  13585.      _go32_dpmi_simulate_fcall(&r);
  13586.      printf("returns %d\n", r.x.ax);
  13587.  
  13588. 
  13589. File: libc,  Node: _go32_dpmi_simulate_fcall_iret,  Next: _go32_dpmi_simulate_int,  Prev: _go32_dpmi_simulate_fcall,  Up: Alphabetical List
  13590.  
  13591. _go32_dpmi_simulate_fcall_iret
  13592. ==============================
  13593.  
  13594. Syntax
  13595. ------
  13596.  
  13597.      #include <dpmi.h>
  13598.      
  13599.      int _go32_dpmi_simulate_fcall_iret(_go32_dpmi_registers *regs);
  13600.  
  13601. Description
  13602. -----------
  13603.  
  13604. *Note DPMI Overview::
  13605.  
  13606. This function simulates a real-mode far call to a function that returns
  13607. with an `iret' instruction.  The registers are set up from REGS,
  13608. including `CS' and `IP', which indicate the address of the call.  Any
  13609. registers the function modifies are reflected in REGS on return.
  13610.  
  13611. If `SS' and `SP' are both zero, a small temporary stack is used when in
  13612. real mode.  If not, they are used AS IS.  It's a good idea to use
  13613. `memset' to initialize the register structure before using it.
  13614.  
  13615. Return Value
  13616. ------------
  13617.  
  13618. Zero on success, nonzero on failure.
  13619.  
  13620. Example
  13621. -------
  13622.  
  13623.      _go32_dpmi_registers r;
  13624.      r.x.ax = 47;
  13625.      r.x.cs = some_segment;
  13626.      r.x.ip = some_offset;
  13627.      r.x.ss = r.x.sp = 0;
  13628.      _go32_dpmi_simulate_fcall_iret(&r);
  13629.      printf("returns %d\n", r.x.ax);
  13630.  
  13631. 
  13632. File: libc,  Node: _go32_dpmi_simulate_int,  Next: _go32_info_block,  Prev: _go32_dpmi_simulate_fcall_iret,  Up: Alphabetical List
  13633.  
  13634. _go32_dpmi_simulate_int
  13635. =======================
  13636.  
  13637. Syntax
  13638. ------
  13639.  
  13640.      #include <dpmi.h>
  13641.      
  13642.      int _go32_dpmi_simulate_int(int vector, _go32_dpmi_registers *regs);
  13643.  
  13644. Description
  13645. -----------
  13646.  
  13647. *Note DPMI Overview::
  13648.  
  13649. This function simulates a real-mode interrup.  The registers are set up
  13650. from REGS, including `CS' and `IP', which indicate the address of the
  13651. call.  Any registers the function modifies are reflected in REGS on
  13652. return.
  13653.  
  13654. If `SS' and `SP' are both zero, a small temporary stack is used when in
  13655. real mode.  If not, they are used AS IS.  It's a good idea to use
  13656. `memset' to initialize the register structure before using it.
  13657.  
  13658. Return Value
  13659. ------------
  13660.  
  13661. Zero on success, nonzero on failure.
  13662.  
  13663. Example
  13664. -------
  13665.  
  13666.      _go32_dpmi_registers r;
  13667.      r.h.ah = 0x08;
  13668.      r.h.dl = 0x80; /* drive C: */
  13669.      r.x.ss = r.x.sp = 0;
  13670.      _go32_dpmi_simulate_int(0x13, &r);
  13671.      printf("disk is %d cyl, %d head, %d sect\n",
  13672.             r.h.ch | ((r.x.cl<<2)&0x300),
  13673.             r.h.dh, r.h.cl & 0x3f));
  13674.  
  13675. 
  13676. File: libc,  Node: _go32_info_block,  Next: _go32_interrupt_stack_size,  Prev: _go32_dpmi_simulate_int,  Up: Alphabetical List
  13677.  
  13678. _go32_info_block
  13679. ================
  13680.  
  13681. Syntax
  13682. ------
  13683.  
  13684.      #include <go32.h>
  13685.      
  13686.      extern __Go32_Info_Block _go32_info_block;
  13687.  
  13688. Description
  13689. -----------
  13690.  
  13691. The go32 information block is a mechanism for `go32' to pass
  13692. information to the application.  Some of this information is generally
  13693. useful, such as the pid or the transfer buffer, while some is used
  13694. internally to `libc.a' only.
  13695.  
  13696. The structure has this format:
  13697.  
  13698.      typedef struct {
  13699.        unsigned long  size_of_this_structure_in_bytes;
  13700.        unsigned long  linear_address_of_primary_screen;
  13701.        unsigned long  linear_address_of_secondary_screen;
  13702.        unsigned long  linear_address_of_transfer_buffer;
  13703.        unsigned long  size_of_transfer_buffer;
  13704.        unsigned long  pid;
  13705.        unsigned char  master_interrupt_controller_base;
  13706.        unsigned char  slave_interrupt_controller_base;
  13707.        unsigned short selector_for_linear_memory;
  13708.        unsigned long  linear_address_of_stub_info_structure;
  13709.        unsigned long  linear_address_of_original_psp;
  13710.        unsigned short run_mode;
  13711.        unsigned short run_mode_info;
  13712.      } Go32_Info_Block;
  13713.  
  13714. The linear address fields provide values that are suitable for
  13715. `dosmemget', `dosmemput', and `movedata'.  The
  13716. selector_for_linear_memory is suitable for `<sys/farptr.h>' selector
  13717. parameters.
  13718.  
  13719. Due to the length of these fields, and their popularity, the following
  13720. macros are available:
  13721.  
  13722. `_dos_ds'
  13723.      This expands to _go32_info_block.selector_for_linear_memory
  13724.  
  13725. `__tb'
  13726.      This expands to _go32_info_block.linear_address_of_transfer_buffer
  13727.  
  13728. The `run_mode' field indicates the mode that the program is running in.
  13729. The following modes are defined:
  13730.  
  13731. `_GO32_RUN_MODE_UNDEF'
  13732.      This indicates that the extender did not (or could not) determine
  13733.      or provide the mode information.  The most probable reason is that
  13734.      it's an older extender that does not support this field.  The
  13735.      program should not assume anything about the run mode if it is
  13736.      this value.
  13737.  
  13738. `_GO32_RUN_MODE_RAW'
  13739.      This indicates that no CPU manager is being used, and no XMS
  13740.      manager is present.  The CPU is being managed directly from the
  13741.      extender, and memory was allocated from the extended memory pool.
  13742.  
  13743. `_GO32_RUN_MODE_XMS'
  13744.      This indicates that the extender is managing the CPU, but an XMS
  13745.      driver is managing the memory pool.
  13746.  
  13747. `_GO32_RUN_MODE_VCPI'
  13748.      This indicates that a VCPI server (like `emm386' or `qemm') is
  13749.      managing both the CPU and the memory.
  13750.  
  13751. `_GO32_RUN_MODE_DPMI'
  13752.      This indicates that a DPMI server (like `qdpmi' or Windows) is
  13753.      managing both the CPU and memory.  Programs may rely on this value
  13754.      to determine if it is safe to use DPMI 0.9 functions.
  13755.  
  13756.      If this value is set, the `run_mode_info' field has the DPMI
  13757.      specification version, in hex, shifted eight bits.  For example,
  13758.      DPMI 0.9 has 0x005A in the `run_mode_info' field.
  13759.  
  13760. Note that the program should not assume that the value will be one of
  13761. the listed values.  If the program is running with an extender that
  13762. provides some other mode (say, a newly released extender) then the
  13763. program should be able to handle that case gracefully.
  13764.  
  13765. Example
  13766. -------
  13767.  
  13768.      dosmemget(_go32_info_block.linear_address_of_primary_screen, 80*25*2, buf);
  13769.  
  13770. 
  13771. File: libc,  Node: _go32_interrupt_stack_size,  Next: _go32_my_cs,  Prev: _go32_info_block,  Up: Alphabetical List
  13772.  
  13773. _go32_interrupt_stack_size
  13774. ==========================
  13775.  
  13776. Syntax
  13777. ------
  13778.  
  13779.      #include <dpmi.h>
  13780.      
  13781.      extern unsigned long _go32_interrupt_stack_size;
  13782.  
  13783. Description
  13784. -----------
  13785.  
  13786. The default size of the interrupt handler's stack.  Defaults to 32k.
  13787.  
  13788. 
  13789. File: libc,  Node: _go32_my_cs,  Next: _go32_my_ds,  Prev: _go32_interrupt_stack_size,  Up: Alphabetical List
  13790.  
  13791. _go32_my_cs
  13792. ===========
  13793.  
  13794. Syntax
  13795. ------
  13796.  
  13797.      #include <go32.h>
  13798.      
  13799.      u_short _go32_my_cs();
  13800.  
  13801. Description
  13802. -----------
  13803.  
  13804. Returns the current `CS'.  This is useful for setting up interrupt
  13805. vectors and such.
  13806.  
  13807. Return Value
  13808. ------------
  13809.  
  13810. `CS'
  13811.  
  13812. 
  13813. File: libc,  Node: _go32_my_ds,  Next: _go32_my_ss,  Prev: _go32_my_cs,  Up: Alphabetical List
  13814.  
  13815. _go32_my_ds
  13816. ===========
  13817.  
  13818. Syntax
  13819. ------
  13820.  
  13821.      #include <go32.h>
  13822.      
  13823.      u_short _go32_my_ds();
  13824.  
  13825. Description
  13826. -----------
  13827.  
  13828. Returns the current `DS'.  This is useful for moving memory and such.
  13829.  
  13830. Return Value
  13831. ------------
  13832.  
  13833. `DS'
  13834.  
  13835. 
  13836. File: libc,  Node: _go32_my_ss,  Next: _go32_rmcb_stack_size,  Prev: _go32_my_ds,  Up: Alphabetical List
  13837.  
  13838. _go32_my_ss
  13839. ===========
  13840.  
  13841. Syntax
  13842. ------
  13843.  
  13844.      #include <go32.h>
  13845.      
  13846.      u_short _go32_my_ss();
  13847.  
  13848. Description
  13849. -----------
  13850.  
  13851. Returns the current `SS'.  This is useful for moving memory and such.
  13852.  
  13853. Return Value
  13854. ------------
  13855.  
  13856. `SS'
  13857.  
  13858. 
  13859. File: libc,  Node: _go32_rmcb_stack_size,  Next: _go32_want_ctrl_break,  Prev: _go32_my_ss,  Up: Alphabetical List
  13860.  
  13861. _go32_rmcb_stack_size
  13862. =====================
  13863.  
  13864. Syntax
  13865. ------
  13866.  
  13867.      #include <dpmi.h>
  13868.      
  13869.      extern unsigned long _go32_rmcb_stack_size;
  13870.  
  13871. Description
  13872. -----------
  13873.  
  13874. The default size of the real mode callback handler's stack.  Defaults
  13875. to 32k.
  13876.  
  13877. 
  13878. File: libc,  Node: _go32_want_ctrl_break,  Next: _go32_was_ctrl_break_hit,  Prev: _go32_rmcb_stack_size,  Up: Alphabetical List
  13879.  
  13880. _go32_want_ctrl_break
  13881. =====================
  13882.  
  13883. Syntax
  13884. ------
  13885.  
  13886.      #include <go32.h>
  13887.      
  13888.      void   _go32_want_ctrl_break(int yes);
  13889.  
  13890. Description
  13891. -----------
  13892.  
  13893. This function tells go32 whether or not it wants `Ctrl-Break' to be an
  13894. exception or passed to the application.  If you pass a nonzero value
  13895. for YES, pressing `Ctrl-Break' will set a flag that can be detected
  13896. with `_go32_was_ctrl_break_hit' (*note _go32_was_ctrl_break_hit::.).
  13897. If you pass zero for YES, When you press `Ctrl-Break' the program will
  13898. be terminated.
  13899.  
  13900. Note that if you call `_go32_was_ctrl_break_hit', this function
  13901. automatically gets called to ask for `Ctrl-Break' events.
  13902.  
  13903. Return Value
  13904. ------------
  13905.  
  13906. None.
  13907.  
  13908. Example
  13909. -------
  13910.  
  13911.      _g32_want_ctrl_break(1);
  13912.      do_something_long();
  13913.      _g32_want_ctrl_break(0);
  13914.  
  13915. 
  13916. File: libc,  Node: _go32_was_ctrl_break_hit,  Next: gotoxy,  Prev: _go32_want_ctrl_break,  Up: Alphabetical List
  13917.  
  13918. _go32_was_ctrl_break_hit
  13919. ========================
  13920.  
  13921. Syntax
  13922. ------
  13923.  
  13924.      #include <go32.h>
  13925.      
  13926.      unsigned _go32_was_ctrl_break_hit(void);
  13927.  
  13928. Description
  13929. -----------
  13930.  
  13931. This function returns the number of times that `Ctrl-Break' was hit
  13932. since the last call to this function or `_go32_want_ctrl_break' (*note
  13933. _go32_want_ctrl_break::.).
  13934.  
  13935. Return Value
  13936. ------------
  13937.  
  13938. Zero if `Ctrl-Break' hasn't been hit, nonzero to indicate how many
  13939. times if it has been hit.
  13940.  
  13941. Note that `_go32_want_ctrl_break' is automatically called to request
  13942. these events, so you don't have to set up for this call.
  13943.  
  13944. Example
  13945. -------
  13946.  
  13947.      while (!_go32_was_ctrl_break_hit())
  13948.        do_something();
  13949.  
  13950. 
  13951. File: libc,  Node: gotoxy,  Next: gppconio_init,  Prev: _go32_was_ctrl_break_hit,  Up: Alphabetical List
  13952.  
  13953. gotoxy
  13954. ======
  13955.  
  13956. Syntax
  13957. ------
  13958.  
  13959.      #include <conio.h>
  13960.      
  13961.      void gotoxy(int x, int y);
  13962.  
  13963. Description
  13964. -----------
  13965.  
  13966. Move the cursor to row y, column x.  The upper left corner of the
  13967. current window is (1,1).
  13968.  
  13969. 
  13970. File: libc,  Node: gppconio_init,  Next: hasmntopt,  Prev: gotoxy,  Up: Alphabetical List
  13971.  
  13972. gppconio_init
  13973. =============
  13974.  
  13975. Syntax
  13976. ------
  13977.  
  13978.      #include <conio.h>
  13979.      
  13980.      void gppconio_init(void);
  13981.  
  13982. Description
  13983. -----------
  13984.  
  13985. Initialize the screen.  This is called automatically at program start-up
  13986. if you use any of the `conio' functions, but there may be times when
  13987. you need to call it again, typically after calling some video BIOS
  13988. function which affects screen parameters.
  13989.  
  13990. 
  13991. File: libc,  Node: hasmntopt,  Next: highvideo,  Prev: gppconio_init,  Up: Alphabetical List
  13992.  
  13993. hasmntopt
  13994. =========
  13995.  
  13996. Syntax
  13997. ------
  13998.  
  13999.      #include <mntent.h>
  14000.      
  14001.      char *hasmntopt(struct mntent *mnt, char *opt);
  14002.  
  14003. Description
  14004. -----------
  14005.  
  14006. This function scans the `mnt_opts' field of the `mntent' structure MNT
  14007. for a substring that matches OPT.  *Note getmntent::.
  14008.  
  14009. Return Value
  14010. ------------
  14011.  
  14012. This function returns the address of the substring if a match is found,
  14013. or `NULL' otherwise.
  14014.  
  14015. 
  14016. File: libc,  Node: highvideo,  Next: htonl,  Prev: hasmntopt,  Up: Alphabetical List
  14017.  
  14018. highvideo
  14019. =========
  14020.  
  14021. Syntax
  14022. ------
  14023.  
  14024.      #include <conio.h>
  14025.      
  14026.      void highvideo(void);
  14027.  
  14028. Description
  14029. -----------
  14030.  
  14031. Causes any new characters put on the screen to be bright.
  14032.  
  14033. 
  14034. File: libc,  Node: htonl,  Next: htons,  Prev: highvideo,  Up: Alphabetical List
  14035.  
  14036. htonl
  14037. =====
  14038.  
  14039. Syntax
  14040. ------
  14041.  
  14042.      #include <netinet/in.h>
  14043.      
  14044.      unsigned long htonl(unsigned long val);
  14045.  
  14046. Description
  14047. -----------
  14048.  
  14049. This function converts from host formatted longs to network formatted
  14050. longs.  For the i386 and higher processors, this means that the bytes
  14051. are swapped from 1234 order to 4321 order.
  14052.  
  14053. Return Value
  14054. ------------
  14055.  
  14056. The network-order value.
  14057.  
  14058. Example
  14059. -------
  14060.  
  14061.      packet.ipaddr = htonl(ip);
  14062.  
  14063. 
  14064. File: libc,  Node: htons,  Next: hypot,  Prev: htonl,  Up: Alphabetical List
  14065.  
  14066. htons
  14067. =====
  14068.  
  14069. Syntax
  14070. ------
  14071.  
  14072.      #include <netinet/in.h>
  14073.      
  14074.      unsigned short htons(unsigned short val);
  14075.  
  14076. Description
  14077. -----------
  14078.  
  14079. This function converts from host formatted shorts to network formatted
  14080. shorts.  For the i386 and higher processors, this means that the bytes
  14081. are swapped from 12 order to 21 order.
  14082.  
  14083. Return Value
  14084. ------------
  14085.  
  14086. The network-order value.
  14087.  
  14088. Example
  14089. -------
  14090.  
  14091.      tcp.port = htons(port);
  14092.  
  14093. 
  14094. File: libc,  Node: hypot,  Next: inb,  Prev: htons,  Up: Alphabetical List
  14095.  
  14096. hypot
  14097. =====
  14098.  
  14099. Syntax
  14100. ------
  14101.  
  14102.      #include <math.h>
  14103.      
  14104.      double hypot(double x, double y);
  14105.  
  14106. Return Value
  14107. ------------
  14108.  
  14109. The length of a hypotenuse of a right triangle whose shorter sides are
  14110. X and Y.  In other words, the distance between (0,0) and (X,Y).
  14111.  
  14112. 
  14113. File: libc,  Node: inb,  Next: index,  Prev: hypot,  Up: Alphabetical List
  14114.  
  14115. inb
  14116. ===
  14117.  
  14118. Syntax
  14119. ------
  14120.  
  14121.      #include <pc.h>
  14122.      
  14123.      unsigned char inb(unsigned short _port);
  14124.  
  14125. Description
  14126. -----------
  14127.  
  14128. Calls *Note inportb::. Provided only for compatibility.
  14129.  
  14130. 
  14131. File: libc,  Node: index,  Next: inp,  Prev: inb,  Up: Alphabetical List
  14132.  
  14133. index
  14134. =====
  14135.  
  14136. Syntax
  14137. ------
  14138.  
  14139.      #include <strings.h>
  14140.      
  14141.      char *index(const char *string, int ch);
  14142.  
  14143. Description
  14144. -----------
  14145.  
  14146. Returns a pointer to the first occurrence of CH in STRING.  Note that
  14147. the `NULL' character counts, so if you pass zero as CH you'll get a
  14148. pointer to the end of the string back.
  14149.  
  14150. Return Value
  14151. ------------
  14152.  
  14153. A pointer to the character, or `NULL' if it wasn't found.
  14154.  
  14155. Example
  14156. -------
  14157.  
  14158.      if (index(path, '*'))
  14159.        do_wildcards(path);
  14160.  
  14161. 
  14162. File: libc,  Node: inp,  Next: inportb,  Prev: index,  Up: Alphabetical List
  14163.  
  14164. inp
  14165. ===
  14166.  
  14167. Syntax
  14168. ------
  14169.  
  14170.      #include <pc.h>
  14171.      
  14172.      unsigned char inp(unsigned short _port);
  14173.  
  14174. Description
  14175. -----------
  14176.  
  14177. Calls *Note inportb::.  Provided only for compatibility.
  14178.  
  14179. 
  14180. File: libc,  Node: inportb,  Next: inportl,  Prev: inp,  Up: Alphabetical List
  14181.  
  14182. inportb
  14183. =======
  14184.  
  14185. Syntax
  14186. ------
  14187.  
  14188.      #include <pc.h>
  14189.      
  14190.      unsigned char inportb(unsigned short _port);
  14191.  
  14192. Description
  14193. -----------
  14194.  
  14195. Read a single 8-bit I/O port.
  14196.  
  14197. This function is provided as an inline assembler macro, and will be
  14198. optimized down to a single opcode when you optimize your program.
  14199.  
  14200. Return Value
  14201. ------------
  14202.  
  14203. The value returned through the port.
  14204.  
  14205. 
  14206. File: libc,  Node: inportl,  Next: inportsb,  Prev: inportb,  Up: Alphabetical List
  14207.  
  14208. inportl
  14209. =======
  14210.  
  14211. Syntax
  14212. ------
  14213.  
  14214.      #include <pc.h>
  14215.      
  14216.      unsigned long inportl(unsigned short _port);
  14217.  
  14218. Description
  14219. -----------
  14220.  
  14221. This function reads a single 32-bit I/O port.
  14222.  
  14223. This function is provided as an inline assembler macro, and will be
  14224. optimized down to a single opcode when you optimize your program.
  14225.  
  14226. Return Value
  14227. ------------
  14228.  
  14229. The value returned from the port.
  14230.  
  14231. 
  14232. File: libc,  Node: inportsb,  Next: inportsl,  Prev: inportl,  Up: Alphabetical List
  14233.  
  14234. inportsb
  14235. ========
  14236.  
  14237. Syntax
  14238. ------
  14239.  
  14240.      #include <pc.h>
  14241.      
  14242.      void inportsb(unsigned short _port, unsigned char *_buf, unsigned _len);
  14243.  
  14244. Description
  14245. -----------
  14246.  
  14247. Reads the 8-bit _PORT _LEN times, and stores the bytes in BUF.
  14248.  
  14249. 
  14250. File: libc,  Node: inportsl,  Next: inportsw,  Prev: inportsb,  Up: Alphabetical List
  14251.  
  14252. inportsl
  14253. ========
  14254.  
  14255. Syntax
  14256. ------
  14257.  
  14258.      #include <pc.h>
  14259.      
  14260.      void inportsl(unsigned short _port, unsigned long *_buf, unsigned _len);
  14261.  
  14262. Description
  14263. -----------
  14264.  
  14265. Reads the 32-bit _PORT _LEN times, and stores the bytes in BUF.
  14266.  
  14267. 
  14268. File: libc,  Node: inportsw,  Next: inportw,  Prev: inportsl,  Up: Alphabetical List
  14269.  
  14270. inportsw
  14271. ========
  14272.  
  14273. Syntax
  14274. ------
  14275.  
  14276.      #include <pc.h>
  14277.      
  14278.      void inportsw(unsigned short _port, unsigned short *_buf, unsigned _len);
  14279.  
  14280. Description
  14281. -----------
  14282.  
  14283. Reads the 16-bit _PORT _LEN times, and stores the bytes in BUF.
  14284.  
  14285. 
  14286. File: libc,  Node: inportw,  Next: inpw,  Prev: inportsw,  Up: Alphabetical List
  14287.  
  14288. inportw
  14289. =======
  14290.  
  14291. Syntax
  14292. ------
  14293.  
  14294.      #include <pc.h>
  14295.      
  14296.      unsigned short inportw(unsigned short _port);
  14297.  
  14298. Description
  14299. -----------
  14300.  
  14301. Read a single 16-bit I/O port.
  14302.  
  14303. This function is provided as an inline assembler macro, and will be
  14304. optimized down to a single opcode when you optimize your program.
  14305.  
  14306. Return Value
  14307. ------------
  14308.  
  14309. The value returned through the port.
  14310.  
  14311. 
  14312. File: libc,  Node: inpw,  Next: insline,  Prev: inportw,  Up: Alphabetical List
  14313.  
  14314. inpw
  14315. ====
  14316.  
  14317. Syntax
  14318. ------
  14319.  
  14320.      #include <pc.h>
  14321.      
  14322.      unsigned short inpw(unsigned short _port);
  14323.  
  14324. Description
  14325. -----------
  14326.  
  14327. Calls *Note inportw::.  Provided only for compatibility.
  14328.  
  14329. 
  14330. File: libc,  Node: insline,  Next: insque,  Prev: inpw,  Up: Alphabetical List
  14331.  
  14332. insline
  14333. =======
  14334.  
  14335. Syntax
  14336. ------
  14337.  
  14338.      #include <conio.h>
  14339.      
  14340.      void insline(void);
  14341.  
  14342. Description
  14343. -----------
  14344.  
  14345. A blank line is inserted at the current cursor position.  The previous
  14346. line and lines below it scroll down.
  14347.  
  14348. 
  14349. File: libc,  Node: insque,  Next: int386,  Prev: insline,  Up: Alphabetical List
  14350.  
  14351. insque
  14352. ======
  14353.  
  14354. Syntax
  14355. ------
  14356.  
  14357.      #include <search.h>
  14358.      
  14359.      void insque(struct qelem *elem, struct qelem *pred);
  14360.  
  14361. Description
  14362. -----------
  14363.  
  14364. This function manipulates queues built from doubly linked lists.  Each
  14365. element in the queue must be in the form of `struct qelem' which is
  14366. defined thus:
  14367.  
  14368.      struct qelem {
  14369.        struct qelem *q_forw;
  14370.        struct qelem *q_back;
  14371.        char q_data[0];
  14372.      }
  14373.  
  14374. This function inserts ELEM in a queue immediately after PRED.
  14375.  
  14376. Return Value
  14377. ------------
  14378.  
  14379. None.
  14380.  
  14381. 
  14382. File: libc,  Node: int386,  Next: int386x,  Prev: insque,  Up: Alphabetical List
  14383.  
  14384. int386
  14385. ======
  14386.  
  14387. Syntax
  14388. ------
  14389.  
  14390.      #include <dos.h>
  14391.      
  14392.      int int386(int ivec, union REGS *in, union REGS *out);
  14393.  
  14394. Description
  14395. -----------
  14396.  
  14397. This function is equal to `int86' function.  See *Note int86:: for
  14398. further description.
  14399.  
  14400. Return Value
  14401. ------------
  14402.  
  14403. The returned value of `EAX'.
  14404.  
  14405. 
  14406. File: libc,  Node: int386x,  Next: int86,  Prev: int386,  Up: Alphabetical List
  14407.  
  14408. int386x
  14409. =======
  14410.  
  14411. Syntax
  14412. ------
  14413.  
  14414.      #include <dos.h>
  14415.      
  14416.      int int386x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
  14417.  
  14418. Description
  14419. -----------
  14420.  
  14421. This function is equal to `int86x'.  See *Note int86:: for further
  14422. description.
  14423.  
  14424. Return Value
  14425. ------------
  14426.  
  14427. The value of `EAX' is returned.
  14428.  
  14429. 
  14430. File: libc,  Node: int86,  Next: int86x,  Prev: int386x,  Up: Alphabetical List
  14431.  
  14432. int86
  14433. =====
  14434.  
  14435. Syntax
  14436. ------
  14437.  
  14438.      #include <dos.h>
  14439.      
  14440.      int int86(int ivec, union REGS *in, union REGS *out);
  14441.  
  14442. Description
  14443. -----------
  14444.  
  14445. Note: The `.x.' branch is a problem generator.  Most code expects the
  14446. `.x.' branch to have e.g. "`.x.ax'" members, and that they are 16-bit.
  14447. If you know you want 32-bit values, use the `.d.eax' members.  If you
  14448. know you want 16-bit values, use the `.w.ax' members.  The `.x.'
  14449. members behave according to `#defines', as follows:
  14450.  
  14451. `default'
  14452.      If you specify no `#define', the `.x.' branch has "`ax'" members
  14453.      and is 32-bit.  This is compatible with previous versions of djgpp.
  14454.  
  14455. `_NAIVE_DOS_REGS'
  14456.      This define gives you `.x.ax', but they are 16-bit.  This is
  14457.      probably what most programs ported from 16-bit dos compilers will
  14458.      want.
  14459.  
  14460. `_BORLAND_DOS_REGS'
  14461.      This define gives you `.x.eax' which are 32-bit.  This is
  14462.      compatible with Borland's 32-bit compilers.
  14463.  
  14464. This function simulates a software interrupt.  Note that, unlike the
  14465. `__dpmi_int' function, requests that go through `int86' and similar
  14466. functions are specially processed to make them suitable for invoking
  14467. real-mode interrupts from protected-mode programs.  For example, if a
  14468. particular routine takes a pointer in `BX', `int86' expects you to put
  14469. a (protected-mode) pointer in `EBX'.  Therefore, `int86' should have
  14470. specific support for every interrupt and function you invoke this way.
  14471. Currently, it supports only a subset of all available interrupts and
  14472. functions:
  14473.  
  14474. 1) All functions of any interrupt which expects only scalar arguments
  14475. registers (i.e., no pointers to buffers).
  14476.  
  14477. 2) In addition, the following functions of interrupt 21h are supported:
  14478. 9, 39h, 3Ah, 3Bh, 3Ch, 3Dh, 3Fh, 40h, 41h, 43h, 47h, 56h.
  14479.  
  14480. When the interrupt is invoked, the CPU registers are copied from IN.
  14481. After the interrupt, the CPU registers are copied to OUT.
  14482.  
  14483. This function is just like `int86x' (*note int86x::.) except that
  14484. suitable default values are used for the segment registers.
  14485.  
  14486. *Note int86x::. *Note intdos::. *Note bdos::.
  14487.  
  14488. Return Value
  14489. ------------
  14490.  
  14491. The returned value of `EAX'.
  14492.  
  14493. Example
  14494. -------
  14495.  
  14496.      union REGS r;
  14497.      r.x.ax = 0x0100;
  14498.      r.h.dl = 'c';
  14499.      int86(0x21, &r, &r);
  14500.  
  14501. 
  14502. File: libc,  Node: int86x,  Next: intdos,  Prev: int86,  Up: Alphabetical List
  14503.  
  14504. int86x
  14505. ======
  14506.  
  14507. Syntax
  14508. ------
  14509.  
  14510.      #include <dos.h>
  14511.      
  14512.      int int86x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg);
  14513.  
  14514. Description
  14515. -----------
  14516.  
  14517. This function is just like `int86' (*note int86::.) except that values
  14518. you pass in SREGS are used for the segment registers instead of the
  14519. defaults.
  14520.  
  14521. *Note int86::. *Note intdos::. *Note bdos::.
  14522.  
  14523. Return Value
  14524. ------------
  14525.  
  14526. The value of `EAX' is returned.
  14527.  
  14528. Example
  14529. -------
  14530.  
  14531.      union REGS r;
  14532.      struct SREGS s;
  14533.      r.h.ah = 0x31;
  14534.      r.h.dl = 'c';
  14535.      r.x.si = si_val;
  14536.      s.ds = ds_val;
  14537.      int86x(0x21, &r, &r, &s);
  14538.  
  14539. 
  14540. File: libc,  Node: intdos,  Next: intdosx,  Prev: int86x,  Up: Alphabetical List
  14541.  
  14542. intdos
  14543. ======
  14544.  
  14545. Syntax
  14546. ------
  14547.  
  14548.      #include <dos.h>
  14549.      
  14550.      int intdos(union REGS *in, union REGS *out);
  14551.  
  14552. Description
  14553. -----------
  14554.  
  14555. This function is just like `int86' (*note int86x::.) except that the
  14556. interrupt vector is 0x21.
  14557.  
  14558. Return Value
  14559. ------------
  14560.  
  14561. `EAX'
  14562.  
  14563. 
  14564. File: libc,  Node: intdosx,  Next: _is_executable,  Prev: intdos,  Up: Alphabetical List
  14565.  
  14566. intdosx
  14567. =======
  14568.  
  14569. Syntax
  14570. ------
  14571.  
  14572.      #include <dos.h>
  14573.      
  14574.      int intdosx(union REGS *in, union REGS *out, struct SREGS *s);
  14575.  
  14576. Description
  14577. -----------
  14578.  
  14579. This function is just like `int86x' (*note int86x::.) except that the
  14580. interrupt vector is 0x21.
  14581.  
  14582. Return Value
  14583. ------------
  14584.  
  14585. `EAX'
  14586.  
  14587. 
  14588. File: libc,  Node: _is_executable,  Next: isalnum,  Prev: intdosx,  Up: Alphabetical List
  14589.  
  14590. _is_executable
  14591. ==============
  14592.  
  14593. Syntax
  14594. ------
  14595.  
  14596.      #include <sys/stat.h>
  14597.      
  14598.      int _is_executable(const char *path, int fhandle, const char *extension);
  14599.  
  14600. Description
  14601. -----------
  14602.  
  14603. This function determines if a file is executable under DOS/DJGPP
  14604. environment.  The file may be given either by its PATH or its file
  14605. handle FHANDLE.  If EXTENSION is non-NULL and non-empty, it is used
  14606. first to look up in a list of known extensions which determine whether
  14607. the file is executable.  (If the _STAT_EXEC_EXT bit of the *Note
  14608. _djstat_flags:: global variable is not set, this step is skipped.) If
  14609. EXTENSION is unavailable or not enough to determine the result, the
  14610. first 2 bytes of the file are checked to contain one of the known
  14611. `magic numbers' identifying the file as executable.  If the file's 2
  14612. first bytes need to be read but the read fails, 0 is returned and errno
  14613. is set.  (The file is only searched for magic number if the
  14614. _STAT_EXEC_MAGIC bit of the *Note _djstat_flags:: variable is set.)
  14615.  
  14616. Note that if _STAT_EXEC_MAGIC is set, but _STAT_EXEC_EXT is not, some
  14617. files which shouldn't be flagged as executables (e.g., COFF *.o object
  14618. files) will have their execute bit set, because they have the magic
  14619. number signature at their beginning.  Therefore, only use the above
  14620. combination if you want to debug the list of extensions provided in
  14621. is_exec.c file.
  14622.  
  14623. If the file passed by its handle was open as write-only, and the
  14624. extension alone isn't enough to determine whether the file is
  14625. executable, then this function returns 0, because it cannot look at the
  14626. `magic number'.
  14627.  
  14628. This function is used internally by `f?stat()'; you are not supposed to
  14629. call it directly.
  14630.  
  14631. Return Value
  14632. ------------
  14633.  
  14634. 1 for executable file, 0 otherwise (including in case of errors in
  14635. accessing the file).
  14636.  
  14637. 
  14638. File: libc,  Node: isalnum,  Next: isalpha,  Prev: _is_executable,  Up: Alphabetical List
  14639.  
  14640. isalnum
  14641. =======
  14642.  
  14643. Syntax
  14644. ------
  14645.  
  14646.      #include <ctype.h>
  14647.      
  14648.      int isalnum(int c);
  14649.  
  14650. Description
  14651. -----------
  14652.  
  14653. Tells if C is any letter or digit.
  14654.  
  14655. Return Value
  14656. ------------
  14657.  
  14658. Nonzero if C is a letter or digit, else zero.
  14659.  
  14660. Example
  14661. -------
  14662.  
  14663. 
  14664. File: libc,  Node: isalpha,  Next: isascii,  Prev: isalnum,  Up: Alphabetical List
  14665.  
  14666. isalpha
  14667. =======
  14668.  
  14669. Syntax
  14670. ------
  14671.  
  14672.      #include <ctype.h>
  14673.      
  14674.      int isalpha(int c);
  14675.  
  14676. Description
  14677. -----------
  14678.  
  14679. Tells if C is a letter.
  14680.  
  14681. Return Value
  14682. ------------
  14683.  
  14684. Nonzero if C is a letter, else zero.
  14685.  
  14686. 
  14687. File: libc,  Node: isascii,  Next: isatty,  Prev: isalpha,  Up: Alphabetical List
  14688.  
  14689. isascii
  14690. =======
  14691.  
  14692. Syntax
  14693. ------
  14694.  
  14695.      #include <ctype.h>
  14696.      
  14697.      int isascii(int c);
  14698.  
  14699. Description
  14700. -----------
  14701.  
  14702. Tells if C is an ASCII character (0x00 to 0x7f).
  14703.  
  14704. Return Value
  14705. ------------
  14706.  
  14707. Nonzero if C is ASCII, else zero.
  14708.  
  14709. 
  14710. File: libc,  Node: isatty,  Next: iscntrl,  Prev: isascii,  Up: Alphabetical List
  14711.  
  14712. isatty
  14713. ======
  14714.  
  14715. Syntax
  14716. ------
  14717.  
  14718.      #include <unistd.h>
  14719.      
  14720.      int isatty(int fd);
  14721.  
  14722. Description
  14723. -----------
  14724.  
  14725. Tells if the file descriptor refers to a terminal device or not.
  14726.  
  14727. Return Value
  14728. ------------
  14729.  
  14730. Nonzero if FD is a terminal device, zero  otherwise.
  14731.  
  14732. Example
  14733. -------
  14734.  
  14735.      if (isatty(1))
  14736.        fflush(stdout);
  14737.  
  14738. 
  14739. File: libc,  Node: iscntrl,  Next: isdigit,  Prev: isatty,  Up: Alphabetical List
  14740.  
  14741. iscntrl
  14742. =======
  14743.  
  14744. Syntax
  14745. ------
  14746.  
  14747.      #include <ctype.h>
  14748.      
  14749.      int iscntrl(int c);
  14750.  
  14751. Description
  14752. -----------
  14753.  
  14754. Tells if C is a control character.
  14755.  
  14756. Return Value
  14757. ------------
  14758.  
  14759. Nonzero if C is a control character, else zero.
  14760.  
  14761. 
  14762. File: libc,  Node: isdigit,  Next: isgraph,  Prev: iscntrl,  Up: Alphabetical List
  14763.  
  14764. isdigit
  14765. =======
  14766.  
  14767. Syntax
  14768. ------
  14769.  
  14770.      #include <ctype.h>
  14771.      
  14772.      int isdigit(int c);
  14773.  
  14774. Description
  14775. -----------
  14776.  
  14777. Tells if C is a digit.
  14778.  
  14779. Return Value
  14780. ------------
  14781.  
  14782. Nonzero if C is a digit, else zero.
  14783.  
  14784. 
  14785. File: libc,  Node: isgraph,  Next: islower,  Prev: isdigit,  Up: Alphabetical List
  14786.  
  14787. isgraph
  14788. =======
  14789.  
  14790. Syntax
  14791. ------
  14792.  
  14793.      #include <ctype.h>
  14794.      
  14795.      int isgraph(int c);
  14796.  
  14797. Description
  14798. -----------
  14799.  
  14800. Tells if C is a visible printing character.  Space is not included.
  14801.  
  14802. Return Value
  14803. ------------
  14804.  
  14805. Nonzero if C is a visible printing character, else zero.
  14806.  
  14807. 
  14808. File: libc,  Node: islower,  Next: isprint,  Prev: isgraph,  Up: Alphabetical List
  14809.  
  14810. islower
  14811. =======
  14812.  
  14813. Syntax
  14814. ------
  14815.  
  14816.      #include <ctype.h>
  14817.      
  14818.      int islower(int c);
  14819.  
  14820. Description
  14821. -----------
  14822.  
  14823. Tells if C is lower case or not.
  14824.  
  14825. Return Value
  14826. ------------
  14827.  
  14828. Nonzero if C is lower case, else zero.
  14829.  
  14830. 
  14831. File: libc,  Node: isprint,  Next: ispunct,  Prev: islower,  Up: Alphabetical List
  14832.  
  14833. isprint
  14834. =======
  14835.  
  14836. Syntax
  14837. ------
  14838.  
  14839.      #include <ctype.h>
  14840.      
  14841.      int isprint(int c);
  14842.  
  14843. Description
  14844. -----------
  14845.  
  14846. Tells if C is a printing character, which includes the space character.
  14847.  
  14848. Return Value
  14849. ------------
  14850.  
  14851. Nonzero if C is a printing character, else zero.
  14852.  
  14853. 
  14854. File: libc,  Node: ispunct,  Next: isspace,  Prev: isprint,  Up: Alphabetical List
  14855.  
  14856. ispunct
  14857. =======
  14858.  
  14859. Syntax
  14860. ------
  14861.  
  14862.      #include <ctype.h>
  14863.      
  14864.      int ispunct(int c);
  14865.  
  14866. Description
  14867. -----------
  14868.  
  14869. Tells if C is any printing character except space and those indicated
  14870. by `isalnum'.
  14871.  
  14872. Return Value
  14873. ------------
  14874.  
  14875. Nonzero if C is punctuation, else zero.
  14876.  
  14877. 
  14878. File: libc,  Node: isspace,  Next: isupper,  Prev: ispunct,  Up: Alphabetical List
  14879.  
  14880. isspace
  14881. =======
  14882.  
  14883. Syntax
  14884. ------
  14885.  
  14886.      #include <ctype.h>
  14887.      
  14888.      int isspace(int c);
  14889.  
  14890. Description
  14891. -----------
  14892.  
  14893. Tells if C is whitespace, that is, carriage return, newline, form feed,
  14894. tab, vertical tab, or space.
  14895.  
  14896. Return Value
  14897. ------------
  14898.  
  14899. Nonzero if C is whitespace, else zero.
  14900.  
  14901. 
  14902. File: libc,  Node: isupper,  Next: isxdigit,  Prev: isspace,  Up: Alphabetical List
  14903.  
  14904. isupper
  14905. =======
  14906.  
  14907. Syntax
  14908. ------
  14909.  
  14910.      #include <ctype.h>
  14911.      
  14912.      int isupper(int c);
  14913.  
  14914. Description
  14915. -----------
  14916.  
  14917. Tells if C is an upper case character or not.
  14918.  
  14919. Return Value
  14920. ------------
  14921.  
  14922. Nonzero if C is upper case, else zero.
  14923.  
  14924. 
  14925. File: libc,  Node: isxdigit,  Next: itoa,  Prev: isupper,  Up: Alphabetical List
  14926.  
  14927. isxdigit
  14928. ========
  14929.  
  14930. Syntax
  14931. ------
  14932.  
  14933.      #include <ctype.h>
  14934.      
  14935.      int isxdigit(int c);
  14936.  
  14937. Description
  14938. -----------
  14939.  
  14940. Tells if C is a valid hexidecimal digit or not.  This includes
  14941. `[0-9a-fA-F]'.
  14942.  
  14943. Return Value
  14944. ------------
  14945.  
  14946. Nonzero if C is a hex digit, else zero.
  14947.  
  14948. 
  14949. File: libc,  Node: itoa,  Next: kbhit,  Prev: isxdigit,  Up: Alphabetical List
  14950.  
  14951. itoa
  14952. ====
  14953.  
  14954. Syntax
  14955. ------
  14956.  
  14957.      #include <stdlib.h>
  14958.      
  14959.      char * itoa(int value, char *string, int radix)
  14960.  
  14961. Description
  14962. -----------
  14963.  
  14964. This function converts its argument VALUE into a null-terminated
  14965. character string using RADIX as the base of the number system.  The
  14966. resulting string with a length of upto 33 bytes (including the optional
  14967. sign and the terminating `NULL' is put into the buffer whose address is
  14968. given by STRING.  For radixes other than 10, VALUE is treated as an
  14969. unsigned int (i.e., the sign bit is not interpreted as such).  The
  14970. argument RADIX should specify the base, between 2 and 36, in which the
  14971. string reprsentation of VALUE is requested.
  14972.  
  14973. Return Value
  14974. ------------
  14975.  
  14976. A pointer to STRING.
  14977.  
  14978. Example
  14979. -------
  14980.  
  14981.      char binary_str[33];
  14982.      
  14983.      (void)itoa(num, binary_str, 2);
  14984.  
  14985. 
  14986. File: libc,  Node: kbhit,  Next: kill,  Prev: itoa,  Up: Alphabetical List
  14987.  
  14988. kbhit
  14989. =====
  14990.  
  14991. Syntax
  14992. ------
  14993.  
  14994.      #include <pc.h>
  14995.      
  14996.      int kbhit(void);
  14997.  
  14998. Description
  14999. -----------
  15000.  
  15001. If the user has hit a key, this function will detect it.  This function
  15002. is very fast when there is no key waiting, so it may be used inside
  15003. loops as needed.
  15004.  
  15005. If you test shift/alt/ctrl status with bios calls (e.g., using `bioskey
  15006. (2)' or `bioskey (0x12)') then you should also use bios calls for
  15007. testing for keys.  This can be done with by `bioskey (1)' or `bioskey
  15008. (0x11)'.  Failing to do so can cause trouble in multitasking
  15009. environments like DESQview/X.
  15010.  
  15011. Return Value
  15012. ------------
  15013.  
  15014. Nonzero if a key has been hit, else zero.
  15015.  
  15016. Example
  15017. -------
  15018.  
  15019.      while (!kbhit())
  15020.        do_stuff();
  15021.  
  15022. 
  15023. File: libc,  Node: kill,  Next: labs,  Prev: kbhit,  Up: Alphabetical List
  15024.  
  15025. kill
  15026. ====
  15027.  
  15028.      #include <signal.h>
  15029.      
  15030.      int    kill(pid_t _pid, int _sig);
  15031.  
  15032. Description
  15033. -----------
  15034.  
  15035. If _PID is the current `getpid()', the given _SIG is raised with *Note
  15036. raise::.
  15037.  
  15038. Return Value
  15039. ------------
  15040.  
  15041. -1 on error, else zero.
  15042.  
  15043. 
  15044. File: libc,  Node: labs,  Next: ldexp,  Prev: kill,  Up: Alphabetical List
  15045.  
  15046. labs
  15047. ====
  15048.  
  15049. Syntax
  15050. ------
  15051.  
  15052.      #include <stdlib.h>
  15053.      
  15054.      long labs(long x);
  15055.  
  15056. Description
  15057. -----------
  15058.  
  15059. This function takes the absolute value of X.  *Note abs::.
  15060.  
  15061. Return Value
  15062. ------------
  15063.  
  15064. |X|
  15065.  
  15066. 
  15067. File: libc,  Node: ldexp,  Next: ldiv,  Prev: labs,  Up: Alphabetical List
  15068.  
  15069. ldexp
  15070. =====
  15071.  
  15072. Syntax
  15073. ------
  15074.  
  15075.      #include <math.h>
  15076.      
  15077.      double ldexp(double val, int exp);
  15078.  
  15079. Return Value
  15080. ------------
  15081.  
  15082. This function returns VAL * 2 ** EXP.
  15083.  
  15084. Example
  15085. -------
  15086.  
  15087.      ldexp(3.5,4) == 3.5 * 16 == 56.0
  15088.  
  15089. 
  15090. File: libc,  Node: ldiv,  Next: link,  Prev: ldexp,  Up: Alphabetical List
  15091.  
  15092. ldiv
  15093. ====
  15094.  
  15095. Syntax
  15096. ------
  15097.  
  15098.      #include <stdlib.h>
  15099.      
  15100.      ldiv_t ldiv(long numerator, long denomonator);
  15101.  
  15102. Description
  15103. -----------
  15104.  
  15105. Returns the quotient and remainder of the division NUMBERATOR divided
  15106. by DENOMONATOR.  The return type is as follows:
  15107.  
  15108.      typedef struct {
  15109.        long quot;
  15110.        long rem;
  15111.      } ldiv_t;
  15112.  
  15113. Return Value
  15114. ------------
  15115.  
  15116. The results of the division are returned.
  15117.  
  15118. Example
  15119. -------
  15120.  
  15121.      ldiv_t l = ldiv(42, 3);
  15122.      printf("42 = %ld x 3 + %ld\n", l.quot, l.rem);
  15123.      
  15124.      ldiv(+40, +3) = { +13, +1 }
  15125.      ldiv(+40, -3) = { -13, -1 }
  15126.      ldiv(-40, +3) = { -13, -1 }
  15127.      ldiv(-40, -3) = { +13, -1 }
  15128.  
  15129. 
  15130. File: libc,  Node: link,  Next: localeconv,  Prev: ldiv,  Up: Alphabetical List
  15131.  
  15132. link
  15133. ====
  15134.  
  15135. Syntax
  15136. ------
  15137.  
  15138.      #include <unistd.h>
  15139.      
  15140.      int link(const char *exists, const char *new);
  15141.  
  15142. Description
  15143. -----------
  15144.  
  15145. Because of limitations of MS-DOS, this function doesn't really link two
  15146. files together.  However, it simulates a real `link' by copying the
  15147. file at EXISTS to NEW.
  15148.  
  15149. Return Value
  15150. ------------
  15151.  
  15152. Zero on success, nonzero on failure.
  15153.  
  15154. Example
  15155. -------
  15156.  
  15157.      link("foo.c", "foo.bak");
  15158.  
  15159. 
  15160. File: libc,  Node: localeconv,  Next: localtime,  Prev: link,  Up: Alphabetical List
  15161.  
  15162. localeconv
  15163. ==========
  15164.  
  15165. Syntax
  15166. ------
  15167.  
  15168.      #include <locale.h>
  15169.      
  15170.      struct lconv *localeconv(void);
  15171.  
  15172. Description
  15173. -----------
  15174.  
  15175. This function returns a pointer to a static structure that contains
  15176. information about the current locale.  The structure contains these
  15177. fields:
  15178.  
  15179. `char *currency_symbol'
  15180.      A string that should be used when printing local currency.
  15181.  
  15182. `char *decimal_point'
  15183.      A string that is used to separate the integer and fractional
  15184.      portions of real numbers in `printf'.  Currently, only the first
  15185.      character is significant.
  15186.  
  15187. `char *grouping'
  15188.      An array of numbers indicating the size of groupings for
  15189.      non-monetary values to the left of the decimal point.  The first
  15190.      number is the size of the grouping just before the decimal point.
  15191.      A number of zero means to repeat the previous number indefinitely.
  15192.      A number of `CHAR_MAX' means to group the remainder of the digits
  15193.      together.
  15194.  
  15195. `char *int_curr_symbol'
  15196.      A string that should be used when formatting monetary values for
  15197.      local currency when the result will be used internationally.
  15198.  
  15199. `char *mon_decimal_point'
  15200.      A string that separates the interger and fractional parts of
  15201.      monetary values.
  15202.  
  15203. `char *mon_grouping'
  15204.      Same as grouping, but for monetary values.
  15205.  
  15206. `char *negative_sign'
  15207.      A string that is used to represent negative monetary values.
  15208.  
  15209. `char *positive_sign'
  15210.      A string that is used to represent positive monetary values.
  15211.  
  15212. `char *thousands_sep'
  15213.      The grouping separator for non-monetary values.
  15214.  
  15215. `char frac_digits'
  15216.      The number of digits to the right of the decimal point for monetary
  15217.      values.
  15218.  
  15219. `char int_frac_digits'
  15220.      Like frac_digits, but when formatting for international use.
  15221.  
  15222. `char n_cs_precedes'
  15223.      If nonzero, the currency string should precede the monetary value
  15224.      if the monetary value is negative.
  15225.  
  15226. `char n_sep_by_space'
  15227.      If nonzero, the currency string and the monetary value should be
  15228.      separated by a space if the monetary value is negative.
  15229.  
  15230. `char n_sign_posn'
  15231.      Determines the placement of the negative indication string if the
  15232.      monetary value is negative.
  15233.  
  15234.     0
  15235.           ($value), (value$)
  15236.  
  15237.     1
  15238.           -$value, -value$
  15239.  
  15240.     2
  15241.           $value-, value$-
  15242.  
  15243.     3
  15244.           -$value, value-$
  15245.  
  15246.     4
  15247.           $-value, value$-
  15248.  
  15249. `char p_cs_precedes'
  15250. `char p_sep_by_space'
  15251. `char p_sign_posn'
  15252.      These are the same as n_*, but for when the monetary value is
  15253.      positive.
  15254.  
  15255. Note that any numeric field may have a value of `CHAR_MAX', which
  15256. indicates that no information is available.
  15257.  
  15258. Return Value
  15259. ------------
  15260.  
  15261. A pointer to the `struct lconv' structure.
  15262.  
  15263. Example
  15264. -------
  15265.  
  15266.      struct lconv *l = localeconv;
  15267.      printf("%s%d\n", l->negative_sign, value);
  15268.  
  15269. 
  15270. File: libc,  Node: localtime,  Next: lock,  Prev: localeconv,  Up: Alphabetical List
  15271.  
  15272. localtime
  15273. =========
  15274.  
  15275. Syntax
  15276. ------
  15277.  
  15278.      #include <time.h>
  15279.      
  15280.      struct tm *localtime(const time_t *tod);
  15281.  
  15282. Description
  15283. -----------
  15284.  
  15285. Converts the time represented by TOD into a structure, correcting for
  15286. the local timezone.  *Note gmtime::.
  15287.  
  15288. Return Value
  15289. ------------
  15290.  
  15291. A pointer to a static structure which is overridden with each call.
  15292.  
  15293. 
  15294. File: libc,  Node: lock,  Next: log,  Prev: localtime,  Up: Alphabetical List
  15295.  
  15296. lock
  15297. ====
  15298.  
  15299. Syntax
  15300. ------
  15301.  
  15302.      #include <io.h>
  15303.      
  15304.      int lock(int fd, long offset, long length);
  15305.  
  15306. Description
  15307. -----------
  15308.  
  15309. Locks a region in file FD using MS-DOS file sharing interface.  The
  15310. region of LENGTH bytes, starting from OFFSET, will become entirely
  15311. inaccessible to other processes. If multiple locks are used on a single
  15312. file they must be non-overlapping. The lock must be removed before the
  15313. file is closed.
  15314.  
  15315. This function will fail unless SHARE, or a network software providing
  15316. similar interface, is installed. This function is compatible with
  15317. Borland C++ function of the same name.
  15318.  
  15319. *Note unlock::.
  15320.  
  15321. Return Value
  15322. ------------
  15323.  
  15324. Zero if successful, nonzero if not.
  15325.  
  15326. 
  15327. File: libc,  Node: log,  Next: log10,  Prev: lock,  Up: Alphabetical List
  15328.  
  15329. log
  15330. ===
  15331.  
  15332. Syntax
  15333. ------
  15334.  
  15335.      #include <math.h>
  15336.      
  15337.      double log(double x);
  15338.  
  15339. Return Value
  15340. ------------
  15341.  
  15342. The natural logarithm of X.
  15343.  
  15344. 
  15345. File: libc,  Node: log10,  Next: log2,  Prev: log,  Up: Alphabetical List
  15346.  
  15347. log10
  15348. =====
  15349.  
  15350. Syntax
  15351. ------
  15352.  
  15353.      #include <math.h>
  15354.      
  15355.      double log10(double x);
  15356.  
  15357. Return Value
  15358. ------------
  15359.  
  15360. The logarithm base 10 of X.
  15361.  
  15362. 
  15363. File: libc,  Node: log2,  Next: longjmp,  Prev: log10,  Up: Alphabetical List
  15364.  
  15365. log2
  15366. ====
  15367.  
  15368. Syntax
  15369. ------
  15370.  
  15371.      #include <math.h>
  15372.      
  15373.      double log2(double x);
  15374.  
  15375. Return Value
  15376. ------------
  15377.  
  15378. The logarithm base 2 of X.
  15379.  
  15380. 
  15381. File: libc,  Node: longjmp,  Next: lowvideo,  Prev: log2,  Up: Alphabetical List
  15382.  
  15383. longjmp
  15384. =======
  15385.  
  15386. Syntax
  15387. ------
  15388.  
  15389.      #include <setjmp.h>
  15390.      
  15391.      void longjmp(jmp_buf env, int val);
  15392.  
  15393. Description
  15394. -----------
  15395.  
  15396. This function reverts back to a CPU state that was stored in ENV by
  15397. `setjmp' (*note setjmp::.).  The state includes all CPU registers, so
  15398. any variable in a register when `setjmp' was called will be preserved,
  15399. and all else will be indeterminate.
  15400.  
  15401. The value passed as VAL will be the return value of `setjmp' when it
  15402. resumes processing there.  If VAL is zero, the return value will be one.
  15403.  
  15404. Return Value
  15405. ------------
  15406.  
  15407. This function does not return.
  15408.  
  15409. Example
  15410. -------
  15411.  
  15412.      jmp_buf j;
  15413.      if (setjmp(j))
  15414.        return;
  15415.      do_something();
  15416.      longjmp(j);
  15417.  
  15418. 
  15419. File: libc,  Node: lowvideo,  Next: lseek,  Prev: longjmp,  Up: Alphabetical List
  15420.  
  15421. lowvideo
  15422. ========
  15423.  
  15424. Syntax
  15425. ------
  15426.  
  15427.      #include <conio.h>
  15428.      
  15429.      void    lowvideo(void);
  15430.  
  15431. Description
  15432. -----------
  15433.  
  15434. Causes any new characters put on the screen to be dim.
  15435.  
  15436. 
  15437. File: libc,  Node: lseek,  Next: malloc,  Prev: lowvideo,  Up: Alphabetical List
  15438.  
  15439. lseek
  15440. =====
  15441.  
  15442. Syntax
  15443. ------
  15444.  
  15445.      #include <unistd.h>
  15446.      
  15447.      off_t lseek(int fd, off_t offset, int whence);
  15448.  
  15449. Description
  15450. -----------
  15451.  
  15452. This function moves the file pointer for FD according to MODE:
  15453.  
  15454. `SEEK_SET'
  15455.      The file pointer is moved to the offset specified.
  15456.  
  15457. `SEEK_CUR'
  15458.      The file pointer is moved relative to its current position.
  15459.  
  15460. `SEEK_END'
  15461.      The file pointer is moved to a position OFFSET bytes from the end
  15462.      of the file.  The offset is usually nonpositive in this case.
  15463.  
  15464. Return Value
  15465. ------------
  15466.  
  15467. The new offset is returned.
  15468.  
  15469. Example
  15470. -------
  15471.  
  15472.      lseek(fd, 12, SEEK_CUR); /* skip 12 bytes */
  15473.  
  15474. 
  15475. File: libc,  Node: malloc,  Next: mblen,  Prev: lseek,  Up: Alphabetical List
  15476.  
  15477. malloc
  15478. ======
  15479.  
  15480. Syntax
  15481. ------
  15482.  
  15483.      #include <stdlib.h>
  15484.      
  15485.      void *malloc(size_t size);
  15486.  
  15487. Description
  15488. -----------
  15489.  
  15490. This function allocates a chunk of memory from the heap large enough to
  15491. hold any object that is SIZE bytes in length.  This memory must be
  15492. returned to the heap with `free' (*note free::.).
  15493.  
  15494. Return Value
  15495. ------------
  15496.  
  15497. A pointer to the allocated memory, or `NULL' if there isn't enough free
  15498. memory to satisfy the request.
  15499.  
  15500. Example
  15501. -------
  15502.  
  15503.      char *c = (char *)malloc(100);
  15504.  
  15505. 
  15506. File: libc,  Node: mblen,  Next: mbstowcs,  Prev: malloc,  Up: Alphabetical List
  15507.  
  15508. mblen
  15509. =====
  15510.  
  15511. Syntax
  15512. ------
  15513.  
  15514.      #include <stdlib.h>
  15515.      
  15516.      int mblen(const char *s, size_t n);
  15517.  
  15518. Description
  15519. -----------
  15520.  
  15521. This function returns the number of characters of string S that make up
  15522. the next multibyte character.  No more than N characters are checked.
  15523.  
  15524. If S is `NULL', the internal shift state is reset.
  15525.  
  15526. Return Value
  15527. ------------
  15528.  
  15529. The number of characters that comprise the next multibyte character.
  15530.  
  15531. Example
  15532. -------
  15533.  
  15534.      int n = mblen(string, INT_MAX);
  15535.      string += n;
  15536.  
  15537. 
  15538. File: libc,  Node: mbstowcs,  Next: mbtowc,  Prev: mblen,  Up: Alphabetical List
  15539.  
  15540. mbstowcs
  15541. ========
  15542.  
  15543. Syntax
  15544. ------
  15545.  
  15546.      #include <stdlib.h>
  15547.      
  15548.      size_t mbstowcs(wchar_t *wcs, const char *s, size_t n);
  15549.  
  15550. Description
  15551. -----------
  15552.  
  15553. Converts a multibyte string to a wide character string.  The result
  15554. will be no more than N wide characters.
  15555.  
  15556. Return Value
  15557. ------------
  15558.  
  15559. The number of wide characters stored.
  15560.  
  15561. Example
  15562. -------
  15563.  
  15564.      int wlen = mbtowcs(wbuf, string, sizeof(wbuf)/sizeof(wchar_t));
  15565.  
  15566. 
  15567. File: libc,  Node: mbtowc,  Next: memccpy,  Prev: mbstowcs,  Up: Alphabetical List
  15568.  
  15569. mbtowc
  15570. ======
  15571.  
  15572. Syntax
  15573. ------
  15574.  
  15575.      #include <stdlib.h>
  15576.      
  15577.      int mbtowc(wchar_t *pwc, const char *s, size_t n);
  15578.  
  15579. Description
  15580. -----------
  15581.  
  15582. Convert the first multibyte sequence in S to a wide character.  At most
  15583. N characters are checked.  If PWC is not `NULL', the result is stored
  15584. there.  If S is null, the internal shift state is reset.
  15585.  
  15586. Return Value
  15587. ------------
  15588.  
  15589. The number of characters used by the multibyte sequence.
  15590.  
  15591. Example
  15592. -------
  15593.  
  15594.      string += mbtowc(&wc, string, strlen(string));
  15595.  
  15596. 
  15597. File: libc,  Node: memccpy,  Next: memchr,  Prev: mbtowc,  Up: Alphabetical List
  15598.  
  15599. memccpy
  15600. =======
  15601.  
  15602. Syntax
  15603. ------
  15604.  
  15605.      #include <string.h>
  15606.      
  15607.      void * memccpy(void *to, const void *from, int ch, size_t nbytes)
  15608.  
  15609. Description
  15610. -----------
  15611.  
  15612. This function copies characters from memory area FROM into TO, stopping
  15613. after the first occurrence of character CH has been copied, or after
  15614. NBYTES characters have been copied, whichever comes first.  The buffers
  15615. should not overlap.
  15616.  
  15617. Return Value
  15618. ------------
  15619.  
  15620. A pointer to the character after the copy of CH in TO, or a `NULL'
  15621. pointer if CH was not found in the first NBYTES characters of FROM.
  15622.  
  15623. Example
  15624. -------
  15625.  
  15626.      char inpbuf[256], dest[81];
  15627.      
  15628.      printf("Enter a path: ");
  15629.      fflush(stdout);
  15630.      gets(inpbuf);
  15631.      memset(dest, 0, sizeof(dest));
  15632.      if (memccpy(dest, inpbuf, '\\', 80))
  15633.        printf("The first directory in path is %s\n", dest);
  15634.      else
  15635.        printf("No explicit directory in path\n");
  15636.  
  15637. 
  15638. File: libc,  Node: memchr,  Next: memcmp,  Prev: memccpy,  Up: Alphabetical List
  15639.  
  15640. memchr
  15641. ======
  15642.  
  15643. Syntax
  15644. ------
  15645.  
  15646.      #include <string.h>
  15647.      
  15648.      void *memchr(const void *string, int ch, size_t num);
  15649.  
  15650. Description
  15651. -----------
  15652.  
  15653. This function searches NUM bytes starting at STRING, looking for the
  15654. first occurence of CH.
  15655.  
  15656. Return Value
  15657. ------------
  15658.  
  15659. A pointer to the first match, or `NULL' if it wasn't found.
  15660.  
  15661. Example
  15662. -------
  15663.  
  15664.      if (memchr(path, '/', strlen(path))
  15665.        do_slash();
  15666.  
  15667. 
  15668. File: libc,  Node: memcmp,  Next: memcpy,  Prev: memchr,  Up: Alphabetical List
  15669.  
  15670. memcmp
  15671. ======
  15672.  
  15673. Syntax
  15674. ------
  15675.  
  15676.      #include <string.h>
  15677.      
  15678.      int memcmp(const void *s1, const void *s2, size_t num);
  15679.  
  15680. Description
  15681. -----------
  15682.  
  15683. This function compares two regions of memory, at S1 and S2, for NUM
  15684. bytes.
  15685.  
  15686. Return Value
  15687. ------------
  15688.  
  15689. zero
  15690.      s1 == s2
  15691.  
  15692. positive
  15693.      s1 > s2
  15694.  
  15695. negative
  15696.      s1 < s2
  15697.  
  15698. 
  15699. File: libc,  Node: memcpy,  Next: memmove,  Prev: memcmp,  Up: Alphabetical List
  15700.  
  15701. memcpy
  15702. ======
  15703.  
  15704. Syntax
  15705. ------
  15706.  
  15707.      #include <string.h>
  15708.      
  15709.      void *memcpy(void *dest, const void *src, int num);
  15710.  
  15711. Description
  15712. -----------
  15713.  
  15714. This function copies NUM bytes from SOURCE to DEST.
  15715.  
  15716. Return Value
  15717. ------------
  15718.  
  15719. DEST
  15720.  
  15721. Example
  15722. -------
  15723.  
  15724.      memcpy(buffer, temp_buffer, BUF_MAX);
  15725.  
  15726. 
  15727. File: libc,  Node: memmove,  Next: memset,  Prev: memcpy,  Up: Alphabetical List
  15728.  
  15729. memmove
  15730. =======
  15731.  
  15732. Syntax
  15733. ------
  15734.  
  15735.      #include <string.h>
  15736.      
  15737.      void *memmove(void *dest, const void *source, int num);
  15738.  
  15739. Description
  15740. -----------
  15741.  
  15742. This function copies NUM bytes from SOURCE to DEST.  The copy is done
  15743. in such a way that if the two regions overlap, the source is always
  15744. read before that byte is changed by writing to the destination.
  15745.  
  15746. Return Value
  15747. ------------
  15748.  
  15749. DEST
  15750.  
  15751. Example
  15752. -------
  15753.  
  15754.      memmove(buf+1, buf, 99);
  15755.      memmove(buf, buf+1, 99);
  15756.  
  15757. 
  15758. File: libc,  Node: memset,  Next: mkdir,  Prev: memmove,  Up: Alphabetical List
  15759.  
  15760. memset
  15761. ======
  15762.  
  15763. Syntax
  15764. ------
  15765.  
  15766.      #include <string.h>
  15767.      
  15768.      void *memset(void *buffer, int ch, size_t num);
  15769.  
  15770. Description
  15771. -----------
  15772.  
  15773. This function stores NUM copies of CH, starting at BUFFER.  This is
  15774. often used to initialize objects to a known value.
  15775.  
  15776. Return Value
  15777. ------------
  15778.  
  15779. BUFFER
  15780.  
  15781. Example
  15782. -------
  15783.  
  15784.      struct tm t;
  15785.      memset(&t, 0, sizeof(t));
  15786.  
  15787. 
  15788. File: libc,  Node: mkdir,  Next: mkfifo,  Prev: memset,  Up: Alphabetical List
  15789.  
  15790. mkdir
  15791. =====
  15792.  
  15793. Syntax
  15794. ------
  15795.  
  15796.      #include <sys/stat.h>
  15797.      
  15798.      int mkdir(const char *path, mode_t mode);
  15799.  
  15800. Description
  15801. -----------
  15802.  
  15803. This function creates a subdirectory.  The MODE field is ignored under
  15804. MS-DOS.
  15805.  
  15806. Return Value
  15807. ------------
  15808.  
  15809. Zero if the subdirectory was created, nonzero on failure.
  15810.  
  15811. Example
  15812. -------
  15813.  
  15814.      mkdir("/usr/tmp", S_IWUSR);
  15815.  
  15816. 
  15817. File: libc,  Node: mkfifo,  Next: mknod,  Prev: mkdir,  Up: Alphabetical List
  15818.  
  15819. mkfifo
  15820. ======
  15821.  
  15822. Description
  15823. -----------
  15824.  
  15825. This function is provided only to assist in porting from Unix.  It
  15826. always returns an error condition.
  15827.  
  15828. 
  15829. File: libc,  Node: mknod,  Next: mkstemp,  Prev: mkfifo,  Up: Alphabetical List
  15830.  
  15831. mknod
  15832. =====
  15833.  
  15834. Description
  15835. -----------
  15836.  
  15837. This function is provided only to assist in porting from Unix.  It
  15838. always returns an error condition.
  15839.  
  15840. 
  15841. File: libc,  Node: mkstemp,  Next: mktemp,  Prev: mknod,  Up: Alphabetical List
  15842.  
  15843. mkstemp
  15844. =======
  15845.  
  15846. Syntax
  15847. ------
  15848.  
  15849.      #include <stdio.h>
  15850.      
  15851.      int mkstemp(char *template);
  15852.  
  15853. Description
  15854. -----------
  15855.  
  15856. TEMPLATE is a file specification that ends with six trailing `X'
  15857. characters.  This function replaces the `XXXXXX' with a set of
  15858. characters such that the resulting file name names a nonexisting file.
  15859. It then creates and opens the file.
  15860.  
  15861. Note that since MS-DOS is limited to eight characters for the file name,
  15862. and since none of the `X''s get replaced by a dot, you can only have
  15863. two additional characters before the `X''s.
  15864.  
  15865. Return Value
  15866. ------------
  15867.  
  15868. The open file descriptor.
  15869.  
  15870. Example
  15871. -------
  15872.  
  15873.      int fd = mkstemp("/tmp/ccXXXXXX");
  15874.  
  15875. 
  15876. File: libc,  Node: mktemp,  Next: mktime,  Prev: mkstemp,  Up: Alphabetical List
  15877.  
  15878. mktemp
  15879. ======
  15880.  
  15881. Syntax
  15882. ------
  15883.  
  15884.      #include <stdio.h>
  15885.      
  15886.      char *mktemp(char *template);
  15887.  
  15888. Description
  15889. -----------
  15890.  
  15891. TEMPLATE is a file specification that ends with six trailing `X'
  15892. characters.  This function replaces the `XXXXXX' with a set of
  15893. characters such that the resulting file name names a nonexisting file.
  15894.  
  15895. Note that since MS-DOS is limited to eight characters for the file name,
  15896. and since none of the `X''s get replaced by a dot, you can only have
  15897. two additional characters before the `X''s.
  15898.  
  15899. Return Value
  15900. ------------
  15901.  
  15902. The resulting filename.
  15903.  
  15904. Example
  15905. -------
  15906.  
  15907.      char template[] = "/tmp/ccXXXXXX";
  15908.      mktemp(template);
  15909.      FILE *q = fopen(template, "w");
  15910.  
  15911. 
  15912. File: libc,  Node: mktime,  Next: modf,  Prev: mktemp,  Up: Alphabetical List
  15913.  
  15914. mktime
  15915. ======
  15916.  
  15917. Syntax
  15918. ------
  15919.  
  15920.      #include <time.h>
  15921.      
  15922.      time_t mktime(struct tm *tptr);
  15923.  
  15924. Description
  15925. -----------
  15926.  
  15927. This function converts a time structure into the number of seconds since
  15928. 00:00:00 GMT 1/1/1970.  It also attempts to normalize the fields of
  15929. TPTR.
  15930.  
  15931. Return Value
  15932. ------------
  15933.  
  15934. The resulting time, or -1 if the time in TPTR cannot be described in
  15935. that format.
  15936.  
  15937. 
  15938. File: libc,  Node: modf,  Next: modfl,  Prev: mktime,  Up: Alphabetical List
  15939.  
  15940. modf
  15941. ====
  15942.  
  15943. Syntax
  15944. ------
  15945.  
  15946.      #include <math.h>
  15947.      
  15948.      double modf(double x, double *pint);
  15949.  
  15950. Description
  15951. -----------
  15952.  
  15953. `modf' breaks down X into its integer portion (which it stores in
  15954. *PINT) and the remaining fractional portion, which it returns.
  15955.  
  15956. Return Value
  15957. ------------
  15958.  
  15959. The fractional portion.
  15960.  
  15961. 
  15962. File: libc,  Node: modfl,  Next: _mono_clear,  Prev: modf,  Up: Alphabetical List
  15963.  
  15964. modfl
  15965. =====
  15966.  
  15967. Syntax
  15968. ------
  15969.  
  15970.      #include <math.h>
  15971.      
  15972.      long double modf(long double x, long double *pint);
  15973.  
  15974. Description
  15975. -----------
  15976.  
  15977. `modfl' breaks down X into its integer portion (which it stores in
  15978. *PINT) and the remaining fractional portion, which it returns.
  15979.  
  15980. Return Value
  15981. ------------
  15982.  
  15983. The fractional portion.
  15984.  
  15985. 
  15986. File: libc,  Node: _mono_clear,  Next: _mono_printf,  Prev: modfl,  Up: Alphabetical List
  15987.  
  15988. _mono_clear
  15989. ===========
  15990.  
  15991. Syntax
  15992. ------
  15993.  
  15994.      #include <sys/mono.h>
  15995.      
  15996.      void _mono_clear(void);
  15997.  
  15998. Description
  15999. -----------
  16000.  
  16001. Clears the monochrome monitor.
  16002.  
  16003. 
  16004. File: libc,  Node: _mono_printf,  Next: _mono_putc,  Prev: _mono_clear,  Up: Alphabetical List
  16005.  
  16006. _mono_printf
  16007. ============
  16008.  
  16009. Syntax
  16010. ------
  16011.  
  16012.      #include <sys/mono.h>
  16013.      
  16014.      void _mono_printf(const char *fmt, ...);
  16015.  
  16016. Description
  16017. -----------
  16018.  
  16019. Like *Note printf::, but prints to the monochrome monitor.
  16020.  
  16021. 
  16022. File: libc,  Node: _mono_putc,  Next: movedata,  Prev: _mono_printf,  Up: Alphabetical List
  16023.  
  16024. _mono_putc
  16025. ==========
  16026.  
  16027. Syntax
  16028. ------
  16029.  
  16030.      #include <mono.h>
  16031.      
  16032.      void _mono_putc(int c);
  16033.  
  16034. Description
  16035. -----------
  16036.  
  16037. Prints a single character to the monochrome monitor.
  16038.  
  16039. 
  16040. File: libc,  Node: movedata,  Next: movedatab,  Prev: _mono_putc,  Up: Alphabetical List
  16041.  
  16042. movedata
  16043. ========
  16044.  
  16045. Syntax
  16046. ------
  16047.  
  16048.      #include <sys/movedata.h>
  16049.      
  16050.      void movedata(unsigned source_selector, unsigned source_offset,
  16051.                    unsigned dest_selector, unsigned dest_offset,
  16052.                    size_t length);
  16053.  
  16054. Description
  16055. -----------
  16056.  
  16057. This function allows the caller to directly transfer information
  16058. between conventional and linear memory, and among each as well.  The
  16059. selectors passed are *not* segment values like in DOS.  They are
  16060. protected mode selectors that can be obtained by the `_my_ds' and
  16061. `_go32_info_block.selector_for_linear_memory' (or just `_dos_ds')
  16062. functions (*Note _my_ds::, *Note _go32_info_block::).  The offsets are
  16063. linear offsets.  If the selector is for the program's data area, this
  16064. offset corresponds to the address of a buffer (like `(int)&something').
  16065. If the selector is for the conventional memory area, the offset is the
  16066. physical address of the memory, which can be computed from a
  16067. traditional segment/offset pair as `segment'*16+`offset'.  For example,
  16068. the color text screen buffer is at offset 0xb8000.
  16069.  
  16070. Return Value
  16071. ------------
  16072.  
  16073. None.
  16074.  
  16075. Example
  16076. -------
  16077.  
  16078.      short blank_row_buf[ScreenCols()];
  16079.      /* scroll screen */
  16080.      movedata(_dos_ds, 0xb8000 + ScreenCols()*2,
  16081.               _dos_ds, 0xb8000,
  16082.               ScreenCols() * (ScreenRows()-1) * 2);
  16083.      /* fill last row */
  16084.      movedata(_my_ds, (int)blank_row_buf,
  16085.               _dos_ds, 0xb8000 + ScreenCols()*(ScreenRows()-1)*2,
  16086.                ScreenCols() * 2);
  16087.  
  16088. 
  16089. File: libc,  Node: movedatab,  Next: movedatal,  Prev: movedata,  Up: Alphabetical List
  16090.  
  16091. movedatab
  16092. =========
  16093.  
  16094. Syntax
  16095. ------
  16096.  
  16097.      #include <sys/movedata.h>
  16098.      
  16099.      void _movedatab(unsigned, unsigned, unsigned, unsigned, size_t);
  16100.  
  16101. Description
  16102. -----------
  16103.  
  16104. Just like *Note movedata::, but all transfers are always 8-bit
  16105. transfers.
  16106.  
  16107. 
  16108. File: libc,  Node: movedatal,  Next: movedataw,  Prev: movedatab,  Up: Alphabetical List
  16109.  
  16110. movedatal
  16111. =========
  16112.  
  16113. Syntax
  16114. ------
  16115.  
  16116.      #include <sys/movedata.h>
  16117.      
  16118.      void _movedatal(unsigned, unsigned, unsigned, unsigned, size_t);
  16119.  
  16120. Description
  16121. -----------
  16122.  
  16123. Just like *Note movedata::, but all transfers are always 32-bit
  16124. transfers, and the count is a count of transfers, not bytes.
  16125.  
  16126. 
  16127. File: libc,  Node: movedataw,  Next: movetext,  Prev: movedatal,  Up: Alphabetical List
  16128.  
  16129. movedataw
  16130. =========
  16131.  
  16132. Syntax
  16133. ------
  16134.  
  16135.      #include <sys/movedata.h>
  16136.      
  16137.      void _movedataw(unsigned, unsigned, unsigned, unsigned, size_t);
  16138.  
  16139. Description
  16140. -----------
  16141.  
  16142. Just like *Note movedata::, but all transfers are always 16-bit
  16143. transfers, and the count is a count of transfers, not bytes.
  16144.  
  16145. 
  16146. File: libc,  Node: movetext,  Next: mprotect,  Prev: movedataw,  Up: Alphabetical List
  16147.  
  16148. movetext
  16149. ========
  16150.  
  16151. Syntax
  16152. ------
  16153.  
  16154.      #include <conio.h>
  16155.      
  16156.      int movetext(int _left, int _top, int _right, int _bottom,
  16157.                   int _destleft, int _desttop);
  16158.  
  16159. Description
  16160. -----------
  16161.  
  16162. Moves a block of text on the screen.
  16163.  
  16164. Return Value
  16165. ------------
  16166.  
  16167. 1 on success, zero on error.
  16168.  
  16169. 
  16170. File: libc,  Node: mprotect,  Next: _my_cs,  Prev: movetext,  Up: Alphabetical List
  16171.  
  16172. mprotect
  16173. ========
  16174.  
  16175. Syntax
  16176. ------
  16177.  
  16178.      #include <sys/types.h>
  16179.      #include <sys/mman.h>
  16180.      
  16181.      int mprotect(void *addr, size_t len, int prot);
  16182.  
  16183. Description
  16184. -----------
  16185.  
  16186. This function modifies the access protection of a memory region.
  16187. Protection occurs in 4Kbyte regions (pages) aligned on 4Kbyte
  16188. boundaries.  All pages in the region will be changed, so ADDR and LEN
  16189. should be multiples of 4096.
  16190.  
  16191. The protection PROT for each page is specified with the values:
  16192. PROT_NONE  Region can not be touched (if or'ed is ignored).
  16193. PROT_READ  Region can be read (can be or'ed with PROT_WRITE).
  16194. PROT_WRITE Region can be written (implies read access).
  16195.  
  16196. This function is only supported on DPMI hosts which provide some V1.0
  16197. extensions on V0.9 memory blocks.
  16198.  
  16199. Return Value
  16200. ------------
  16201.  
  16202. The function returns 0 if successful and the value -1 if all the pages
  16203. could not be set.
  16204.  
  16205. Example
  16206. -------
  16207.  
  16208.      mprotect(readonly_buffer,8192,PROT_READ);
  16209.      mprotect(guard_area,4096,PROT_NONE);
  16210.      mprotect(NULL,4096,PROT_WRITE);    /* Let NULL pointers not generate exceptions */
  16211.  
  16212. 
  16213. File: libc,  Node: _my_cs,  Next: _my_ds,  Prev: mprotect,  Up: Alphabetical List
  16214.  
  16215. _my_cs
  16216. ======
  16217.  
  16218. Syntax
  16219. ------
  16220.  
  16221.      #include <sys/segments.h>
  16222.      
  16223.      unsigned short _my_cs();
  16224.  
  16225. Description
  16226. -----------
  16227.  
  16228. Returns the current `CS'.  This is useful for setting up interrupt
  16229. vectors and such.
  16230.  
  16231. Return Value
  16232. ------------
  16233.  
  16234. `CS'
  16235.  
  16236. 
  16237. File: libc,  Node: _my_ds,  Next: _my_ss,  Prev: _my_cs,  Up: Alphabetical List
  16238.  
  16239. _my_ds
  16240. ======
  16241.  
  16242. Syntax
  16243. ------
  16244.  
  16245.      #include <sys/segments.h>
  16246.      
  16247.      unsigned short _my_ds();
  16248.  
  16249. Description
  16250. -----------
  16251.  
  16252. Returns the current `DS'.  This is useful for setting up interrupt
  16253. vectors and such.
  16254.  
  16255. Return Value
  16256. ------------
  16257.  
  16258. `DS'
  16259.  
  16260. 
  16261. File: libc,  Node: _my_ss,  Next: nice,  Prev: _my_ds,  Up: Alphabetical List
  16262.  
  16263. _my_ss
  16264. ======
  16265.  
  16266. Syntax
  16267. ------
  16268.  
  16269.      #include <sys/segments.h>
  16270.      
  16271.      unsigned short _my_ss();
  16272.  
  16273. Description
  16274. -----------
  16275.  
  16276. Returns the current `SS'.  This is useful for setting up interrupt
  16277. vectors and such.
  16278.  
  16279. Return Value
  16280. ------------
  16281.  
  16282. `SS'
  16283.  
  16284. 
  16285. File: libc,  Node: nice,  Next: normvideo,  Prev: _my_ss,  Up: Alphabetical List
  16286.  
  16287. nice
  16288. ====
  16289.  
  16290. Syntax
  16291. ------
  16292.  
  16293.      #include <unistd.h>
  16294.      
  16295.      int nice(int _increment);
  16296.  
  16297. Description
  16298. -----------
  16299.  
  16300. Adjusts the priority of the process.  Provided for Unix compatibility
  16301. only.
  16302.  
  16303. Return Value
  16304. ------------
  16305.  
  16306. The new nice value.
  16307.  
  16308. 
  16309. File: libc,  Node: normvideo,  Next: nosound,  Prev: nice,  Up: Alphabetical List
  16310.  
  16311. normvideo
  16312. =========
  16313.  
  16314. Syntax
  16315. ------
  16316.  
  16317.      #include <conio.h>
  16318.      
  16319.      void normvideo(void);
  16320.  
  16321. Description
  16322. -----------
  16323.  
  16324. Resets the text attribute to what it was before the program started.
  16325.  
  16326. 
  16327. File: libc,  Node: nosound,  Next: ntohl,  Prev: normvideo,  Up: Alphabetical List
  16328.  
  16329. nosound
  16330. =======
  16331.  
  16332. Syntax
  16333. ------
  16334.  
  16335.      #include <pc.h>
  16336.      
  16337.      void nosound(void);
  16338.  
  16339. Description
  16340. -----------
  16341.  
  16342. Disable the PC speaker.
  16343.  
  16344. 
  16345. File: libc,  Node: ntohl,  Next: ntohs,  Prev: nosound,  Up: Alphabetical List
  16346.  
  16347. ntohl
  16348. =====
  16349.  
  16350. Syntax
  16351. ------
  16352.  
  16353.      #include <netinet/in.h>
  16354.      
  16355.      unsigned long ntohl(unsigned long val);
  16356.  
  16357. Description
  16358. -----------
  16359.  
  16360. This function converts from network formatted longs to host formatted
  16361. longs.  For the i386 and higher processors, this means that the bytes
  16362. are swapped from 1234 order to 4321 order.
  16363.  
  16364. Return Value
  16365. ------------
  16366.  
  16367. The host-order value.
  16368.  
  16369. Example
  16370. -------
  16371.  
  16372.      ip = htonl(packet.ipaddr);
  16373.  
  16374. 
  16375. File: libc,  Node: ntohs,  Next: open,  Prev: ntohl,  Up: Alphabetical List
  16376.  
  16377. ntohs
  16378. =====
  16379.  
  16380. Syntax
  16381. ------
  16382.  
  16383.      #include <netinet/in.h>
  16384.      
  16385.      unsigned short ntohs(unsigned short val);
  16386.  
  16387. Description
  16388. -----------
  16389.  
  16390. This function converts from network formatted shorts to host formatted
  16391. shorts.  For the i386 and higher processors, this means that the bytes
  16392. are swapped from 12 order to 21 order.
  16393.  
  16394. Return Value
  16395. ------------
  16396.  
  16397. The host-order value.
  16398.  
  16399. Example
  16400. -------
  16401.  
  16402.      port = htons(tcp.port);
  16403.  
  16404. 
  16405. File: libc,  Node: open,  Next: _open,  Prev: ntohs,  Up: Alphabetical List
  16406.  
  16407. open
  16408. ====
  16409.  
  16410. Syntax
  16411. ------
  16412.  
  16413.      #include <fcntl.h>
  16414.      #include <sys/stat.h> /* for mode definitions */
  16415.      
  16416.      int open(const char *file, int mode /*, int permissions */);
  16417.  
  16418. Description
  16419. -----------
  16420.  
  16421. This function opens the named FILE in the given MODE, which is any
  16422. combination of the following:
  16423.  
  16424. `O_RDONLY'
  16425.      The file is opened for reading.
  16426.  
  16427. `O_WRONLY'
  16428.      The file is opened for writing.
  16429.  
  16430. `O_RDWR'
  16431.      The file is opened for both reading and writing.
  16432.  
  16433. `O_CREAT'
  16434.      If the file does not exist, it is created. *Note creat::.
  16435.  
  16436. `O_TRUNC'
  16437.      If the file does exist, it is truncated to zero bytes.
  16438.  
  16439. `O_EXCL'
  16440.      If the file exists, and `O_CREAT' is also specified, the `open'
  16441.      call will fail.
  16442.  
  16443. `O_APPEND'
  16444.      The file pointer is positioned at the end of the file before each
  16445.      write.
  16446.  
  16447. `O_TEXT'
  16448.      The file is opened in text mode, meaning that Ctrl-M characters are
  16449.      stripped on reading and added on writing as needed.  The default
  16450.      mode is specified by the `_fmode' variable *Note _fmode::.
  16451.  
  16452. `O_BINARY'
  16453.      The file is opened in binary mode.
  16454.  
  16455. If the file is created by this call, it will be given the read/write
  16456. permissions specified by PERMISSIONS, which may be any combination of
  16457. these values:
  16458.  
  16459. `S_IRUSR'
  16460.      The file is readable.  This is always true for MS-DOS
  16461.  
  16462. `S_IWUSR'
  16463.      The file is writable.
  16464.  
  16465. Other `S_I*' values may be included, but they will be ignored.
  16466.  
  16467. Return Value
  16468. ------------
  16469.  
  16470. If successful, the file descriptor is returned.  On error, a negative
  16471. number is returned and `errno' is set to indicate the error.
  16472.  
  16473. Example
  16474. -------
  16475.  
  16476.      int q = open("/tmp/foo.dat", O_RDONLY|O_BINARY);
  16477.  
  16478. 
  16479. File: libc,  Node: _open,  Next: opendir,  Prev: open,  Up: Alphabetical List
  16480.  
  16481. _open
  16482. =====
  16483.  
  16484. Syntax
  16485. ------
  16486.  
  16487.      #include <io.h>
  16488.      
  16489.      int _open(const char *path, int attrib);
  16490.  
  16491. Description
  16492. -----------
  16493.  
  16494. This is a direct connection to the MS-DOS open function call, int 0x21,
  16495. %ah = 0x3d.  The file is set to binary mode.
  16496.  
  16497. Return Value
  16498. ------------
  16499.  
  16500. The new file descriptor, else -1 on error.
  16501.  
  16502. 
  16503. File: libc,  Node: opendir,  Next: outb,  Prev: _open,  Up: Alphabetical List
  16504.  
  16505. opendir
  16506. =======
  16507.  
  16508. Syntax
  16509. ------
  16510.  
  16511.      #include <dirent.h>
  16512.      
  16513.      extern int __opendir_flags;
  16514.      
  16515.      DIR *opendir(char *name);
  16516.  
  16517. Description
  16518. -----------
  16519.  
  16520. This function "opens" a directory so that you can read the list of file
  16521. names in it.  The pointer returned must be passed to `closedir' when
  16522. you are done with it.  *Note readdir::.
  16523.  
  16524. The global variable `__opendir_flags' can be set to include the
  16525. following values to control the operation of `opendir':
  16526.  
  16527. `__OPENDIR_PRESERVE_CASE'
  16528.      Do not change the case of files to lower case.  Just in case
  16529.      Micros*ft decides to support case-sensitive file systems some day.
  16530.  
  16531. `__OPENDIR_FIND_HIDDEN'
  16532.      Include hidden files and directories in the search.  By default,
  16533.      these are skipped.
  16534.  
  16535. You can simply put "int __opendir_flags = ...;" in your code.  The
  16536. default is to let it get set to zero as an uninitialized variable.
  16537.  
  16538. Return Value
  16539. ------------
  16540.  
  16541. The open directory structure, or `NULL' on error.
  16542.  
  16543. Example
  16544. -------
  16545.  
  16546.      DIR *d = opendir(".");
  16547.      closedir(d);
  16548.  
  16549. 
  16550. File: libc,  Node: outb,  Next: outp,  Prev: opendir,  Up: Alphabetical List
  16551.  
  16552. outb
  16553. ====
  16554.  
  16555. Syntax
  16556. ------
  16557.  
  16558.      #include <pc.h>
  16559.      
  16560.      void outb(unsigned short _port, unsigned char _data);
  16561.  
  16562. Description
  16563. -----------
  16564.  
  16565. Calls *Note outportb::. Provided only for compatibility.
  16566.  
  16567. 
  16568. File: libc,  Node: outp,  Next: outportb,  Prev: outb,  Up: Alphabetical List
  16569.  
  16570. outp
  16571. ====
  16572.  
  16573. Syntax
  16574. ------
  16575.  
  16576.      #include <pc.h>
  16577.      
  16578.      void outp(unsigned short _port, unsigned char  _data);
  16579.  
  16580. Description
  16581. -----------
  16582.  
  16583. Calls *Note outportb::. Provided only for compatibility.
  16584.  
  16585. 
  16586. File: libc,  Node: outportb,  Next: outportl,  Prev: outp,  Up: Alphabetical List
  16587.  
  16588. outportb
  16589. ========
  16590.  
  16591. Syntax
  16592. ------
  16593.  
  16594.      #include <pc.h>
  16595.      
  16596.      void outportb(unsigned short _port, unsigned char  _data);
  16597.  
  16598. Description
  16599. -----------
  16600.  
  16601. Write a single byte to an 8-bit port.
  16602.  
  16603. This function is provided as an inline assembler macro, and will be
  16604. optimized down to a single opcode when you optimize your program.
  16605.  
  16606. 
  16607. File: libc,  Node: outportl,  Next: outportsb,  Prev: outportb,  Up: Alphabetical List
  16608.  
  16609. outportl
  16610. ========
  16611.  
  16612. Syntax
  16613. ------
  16614.  
  16615.      #include <pc.h>
  16616.      
  16617.      void outportl(unsigned short _port, unsigned long _data);
  16618.  
  16619. Description
  16620. -----------
  16621.  
  16622. Write a single long to an 32-bit port.
  16623.  
  16624. This function is provided as an inline assembler macro, and will be
  16625. optimized down to a single opcode when you optimize your program.
  16626.  
  16627. 
  16628. File: libc,  Node: outportsb,  Next: outportsl,  Prev: outportl,  Up: Alphabetical List
  16629.  
  16630. outportsb
  16631. =========
  16632.  
  16633. Syntax
  16634. ------
  16635.  
  16636.      #include <pc.h>
  16637.      
  16638.      void outportsb(unsigned short _port, unsigned char *_buf, unsigned _len);
  16639.  
  16640. Description
  16641. -----------
  16642.  
  16643. Writes the _LEN bytes in _BUF to the 8-bit _PORT.
  16644.  
  16645. 
  16646. File: libc,  Node: outportsl,  Next: outportsw,  Prev: outportsb,  Up: Alphabetical List
  16647.  
  16648. outportsl
  16649. =========
  16650.  
  16651. Syntax
  16652. ------
  16653.  
  16654.      #include <pc.h>
  16655.      
  16656.      void outportsl(unsigned short _port, unsigned long *_buf, unsigned _len);
  16657.  
  16658. Description
  16659. -----------
  16660.  
  16661. Writes the _LEN longs in _BUF to the 32-bit _PORT.
  16662.  
  16663. 
  16664. File: libc,  Node: outportsw,  Next: outportw,  Prev: outportsl,  Up: Alphabetical List
  16665.  
  16666. outportsw
  16667. =========
  16668.  
  16669. Syntax
  16670. ------
  16671.  
  16672.      #include <pc.h>
  16673.      
  16674.      void outportsw(unsigned short _port, unsigned short *_buf, unsigned _len);
  16675.  
  16676. Description
  16677. -----------
  16678.  
  16679. Writes the _LEN shorts in _BUF to the 16-bit _PORT.
  16680.  
  16681. 
  16682. File: libc,  Node: outportw,  Next: outpw,  Prev: outportsw,  Up: Alphabetical List
  16683.  
  16684. outportw
  16685. ========
  16686.  
  16687. Syntax
  16688. ------
  16689.  
  16690.      #include <pc.h>
  16691.      
  16692.      void outportw(unsigned short _port, unsigned short _data);
  16693.  
  16694. Description
  16695. -----------
  16696.  
  16697. Write a single short to an 16-bit port.
  16698.  
  16699. This function is provided as an inline assembler macro, and will be
  16700. optimized down to a single opcode when you optimize your program.
  16701.  
  16702. 
  16703. File: libc,  Node: outpw,  Next: pathconf,  Prev: outportw,  Up: Alphabetical List
  16704.  
  16705. outpw
  16706. =====
  16707.  
  16708. Syntax
  16709. ------
  16710.  
  16711.      #include <pc.h>
  16712.      
  16713.      void outpw(unsigned short _port, unsigned short _data);
  16714.  
  16715. Description
  16716. -----------
  16717.  
  16718. Calls *Note outportw::. Provided only for compatibility.
  16719.  
  16720. 
  16721. File: libc,  Node: pathconf,  Next: pause,  Prev: outpw,  Up: Alphabetical List
  16722.  
  16723. pathconf
  16724. ========
  16725.  
  16726. Syntax
  16727. ------
  16728.  
  16729.      #include <unistd.h>
  16730.      
  16731.      long pathconf(const char *filename, int name);
  16732.  
  16733. Description
  16734. -----------
  16735.  
  16736. This function returns various system-dependent configuration values.
  16737. The NAME is one of the following:
  16738.  
  16739. `_PC_LINK_MAX'
  16740.      The maximum number of directory entries that can refer to a single
  16741.      real file.
  16742.  
  16743. `_PC_MAX_CANON'
  16744.      The maximum number of bytes in an editable input line.
  16745.  
  16746. `_PC_MAX_INPUT'
  16747.      The maximum number of bytes in a non-editable input line.
  16748.  
  16749. `_PC_NAME_MAX'
  16750.      The maximum length of an individual file name.
  16751.  
  16752. `_PC_PATH_MAX'
  16753.      The maximum length of a complete path name.
  16754.  
  16755. `_PC_PIPE_BUF'
  16756.      The size of a pipe's internal buffer.
  16757.  
  16758. `_PC_CHOWN_RESTRICTED'
  16759.      If non-zero, only privileged user can chown() files, otherwise
  16760.      anyone may give away files.
  16761.  
  16762. `_PC_NO_TRUNC'
  16763.      If false filenames longer than `_PC_NAME_MAX' are truncated,
  16764.      otherwise an error occurs if you use longer names.
  16765.  
  16766. `_PC_VDISABLE'
  16767.      A character to use to disable tty special characters.
  16768.  
  16769. Return Value
  16770. ------------
  16771.  
  16772. The selected configuration value is returned.
  16773.  
  16774. Example
  16775. -------
  16776.  
  16777.      char *buf = malloc(pathconf("c:/", _PC_MAX_PATH)+1);
  16778.  
  16779. 
  16780. File: libc,  Node: pause,  Next: pclose,  Prev: pathconf,  Up: Alphabetical List
  16781.  
  16782. pause
  16783. =====
  16784.  
  16785. Syntax
  16786. ------
  16787.  
  16788.      #include <unistd.h>
  16789.      
  16790.      int pause(void);
  16791.  
  16792. Description
  16793. -----------
  16794.  
  16795. This function just calls `__dpmi_yield()' (*note __dpmi_yield::.) to
  16796. give up a slice of the CPU.
  16797.  
  16798. Return Value
  16799. ------------
  16800.  
  16801. Zero.
  16802.  
  16803. 
  16804. File: libc,  Node: pclose,  Next: perror,  Prev: pause,  Up: Alphabetical List
  16805.  
  16806. pclose
  16807. ======
  16808.  
  16809. Syntax
  16810. ------
  16811.  
  16812.      #include <stdio.h>
  16813.      
  16814.      int pclose(FILE *pipe);
  16815.  
  16816. Description
  16817. -----------
  16818.  
  16819. This function closes a pipe opened with `popen' (*note popen::.).  Note
  16820. that since MS-DOS is not multitasking, this function will actually run
  16821. the program specified in `popen' if the pipe was opened for writing.
  16822.  
  16823. Return Value
  16824. ------------
  16825.  
  16826. Zero on success, nonzero on failure.
  16827.  
  16828. Example
  16829. -------
  16830.  
  16831.      FILE *f = popen("sort", "w");
  16832.      write_to_pipe(f);
  16833.      pclose(f);
  16834.  
  16835. 
  16836. File: libc,  Node: perror,  Next: pipe,  Prev: pclose,  Up: Alphabetical List
  16837.  
  16838. perror
  16839. ======
  16840.  
  16841. Syntax
  16842. ------
  16843.  
  16844.      #include <stdio.h>
  16845.      
  16846.      void perror(const char *string);
  16847.  
  16848. Description
  16849. -----------
  16850.  
  16851. This function formats an error message and prints it to `stderr'.  The
  16852. message is the STRING, a colon, and a message suitable for the error
  16853. condition indicated by `errno'.
  16854.  
  16855. Return Value
  16856. ------------
  16857.  
  16858. None.
  16859.  
  16860. Example
  16861. -------
  16862.  
  16863.      int x = open("foo", O_RDONLY);
  16864.      if (x < 0)
  16865.      {
  16866.        perror("foo");
  16867.        exit(1);
  16868.      }
  16869.  
  16870. 
  16871. File: libc,  Node: pipe,  Next: popen,  Prev: perror,  Up: Alphabetical List
  16872.  
  16873. pipe
  16874. ====
  16875.  
  16876. Description
  16877. -----------
  16878.  
  16879. This function is provided only to assist in porting from Unix.  It
  16880. always returns an error condition.
  16881.  
  16882. 
  16883. File: libc,  Node: popen,  Next: pow,  Prev: pipe,  Up: Alphabetical List
  16884.  
  16885. popen
  16886. =====
  16887.  
  16888. Syntax
  16889. ------
  16890.  
  16891.      #include <stdio.h>
  16892.      
  16893.      FILE *popen(const char *program, const char *mode);
  16894.  
  16895. Description
  16896. -----------
  16897.  
  16898. This function executes the named `program' and attaches either its
  16899. input stream or its output stream to the returned file.  While the file
  16900. is open, the calling program can write to the program (if the program
  16901. was open for writing) or read the program's output (if the program was
  16902. opened for reading).  When the program is done, or if you have no more
  16903. input for it, pass the file pointer to `pclose' (*note pclose::.),
  16904. which terminates the program.
  16905.  
  16906. Since MS-DOS does not support multitasking, this function actually runs
  16907. the entire program when the program is opened for reading, and stores
  16908. the output in a temporary file.  `pclose' then removes that file.
  16909. Similarly, when you open a program for writing, a temp file holds the
  16910. data and `pclose' runs the entire program.
  16911.  
  16912. The MODE is the same as for `fopen' (*note fopen::.).
  16913.  
  16914. Return Value
  16915. ------------
  16916.  
  16917. An open file which can be used to read the program's output or write to
  16918. the program's input.
  16919.  
  16920. Example
  16921. -------
  16922.  
  16923.      FILE *p = popen("dir", "r");
  16924.      read_program(p);
  16925.      pclose(p);
  16926.  
  16927. 
  16928. File: libc,  Node: pow,  Next: pow10,  Prev: popen,  Up: Alphabetical List
  16929.  
  16930. pow
  16931. ===
  16932.  
  16933. Syntax
  16934. ------
  16935.  
  16936.      #include <math.h>
  16937.      
  16938.      double pow(double x, double y);
  16939.  
  16940. Return Value
  16941. ------------
  16942.  
  16943. X raised to the Y power.
  16944.  
  16945. 
  16946. File: libc,  Node: pow10,  Next: pow2,  Prev: pow,  Up: Alphabetical List
  16947.  
  16948. pow10
  16949. =====
  16950.  
  16951. Syntax
  16952. ------
  16953.  
  16954.      #include <math.h>
  16955.      
  16956.      double pow10(double x);
  16957.  
  16958. Return Value
  16959. ------------
  16960.  
  16961. 10 raised to the X power.
  16962.  
  16963. 
  16964. File: libc,  Node: pow2,  Next: printf,  Prev: pow10,  Up: Alphabetical List
  16965.  
  16966. pow2
  16967. ====
  16968.  
  16969. Syntax
  16970. ------
  16971.  
  16972.      #include <math.h>
  16973.      
  16974.      double pow2(double x);
  16975.  
  16976. Return Value
  16977. ------------
  16978.  
  16979. 2 raised to the X power.
  16980.  
  16981. 
  16982. File: libc,  Node: printf,  Next: putc,  Prev: pow2,  Up: Alphabetical List
  16983.  
  16984. printf
  16985. ======
  16986.  
  16987. Syntax
  16988. ------
  16989.  
  16990.      #include <stdio.h>
  16991.      
  16992.      int printf(const char *format, ...);
  16993.  
  16994. Description
  16995. -----------
  16996.  
  16997. Sends formatted output from the arguments (...) to `stdout'.
  16998.  
  16999. The format string contains regular characters to print, as well as
  17000. conversion specifiers, which begin with a percent symbol.  Each
  17001. conversion speficier contains the following fields:
  17002.  
  17003.    *  an optional flag, which may alter the conversion:
  17004.  
  17005.     `-'
  17006.           left-justify the field.
  17007.  
  17008.     `+'
  17009.           Force a `+' sign on positive numbers.
  17010.  
  17011.     `space'
  17012.           To leave a blank space where a plus or minus sign would have
  17013.           been.
  17014.  
  17015.     `#'
  17016.           Alternate conversion - prefix octal numbers with `0',
  17017.           hexadecimal numbers with `0x' or `0X', or force a trailing
  17018.           decimal point if a floating point conversion would have
  17019.           omitted it.
  17020.  
  17021.     `0'
  17022.           To pad numbers with leading zeros.
  17023.  
  17024.    *  A field width specifier, which specifies the minimum width of the
  17025.      field.  This may also be an asterisk (`*'), which means that the
  17026.      actual width will be obtained from the next argument.  If the
  17027.      argument is negative, it supplies a `-' flag and a positive width.
  17028.  
  17029.    *  An optional decimal point and a precision.  This may also be an
  17030.      asterisk, but a negative argument for it indicates a precision of
  17031.      zero.  The precision specifies the minimum number of digits to
  17032.      print for an integer, the number of fraction digits for a floating
  17033.      point number (max for `g' or `G', actual for others), or the
  17034.      maximum number of characters for a string.
  17035.  
  17036.    *  An optional conversion qualifier, which may be `h' to specify
  17037.      `short', `l' to specify long ints, or `L' to specify long doubles.
  17038.  
  17039.    *  The conversion type specifier:
  17040.  
  17041.     `c'
  17042.           A single character
  17043.  
  17044.     `d'
  17045.           A signed integer
  17046.  
  17047.     `D'
  17048.           A signed long integer
  17049.  
  17050.     `e'
  17051.     `E'
  17052.           A floating point number (double or long double).  The
  17053.           exponent case matches the specifier case.  The representation
  17054.           always has an exponent.
  17055.  
  17056.     `f'
  17057.           A floating point number (double or long double).  The
  17058.           representation never has an exponent.
  17059.  
  17060.     `g'
  17061.     `G'
  17062.           A floating point number (double or long double).  The
  17063.           exponent case matches the specifier case.  The representation
  17064.           has an exponent if it needs one.
  17065.  
  17066.     `i'
  17067.           A signed integer.
  17068.  
  17069.     `n'
  17070.           The next argument is a pointer to an integer, and the number
  17071.           of characters generated so far is stored in that integer.
  17072.  
  17073.     `o'
  17074.           A unsigned integer, printed in base 8 instead of base 10.
  17075.  
  17076.     `p'
  17077.           A pointer.  This is printed with an `x' specifier.
  17078.  
  17079.     `s'
  17080.           A `NULL'-terminated string.
  17081.  
  17082.     `u'
  17083.           An unsigned integer.
  17084.  
  17085.     `U'
  17086.           An unsigned long integer.
  17087.  
  17088.     `x'
  17089.     `X'
  17090.           An unsigned integer, printed in base 16 instead of base 10.
  17091.           The case of the letters used matches the specifier case.
  17092.  
  17093.     `%'
  17094.           A single percent symbol is printed.
  17095.  
  17096. Return Value
  17097. ------------
  17098.  
  17099. The number of characters written.
  17100.  
  17101. Example
  17102. -------
  17103.  
  17104.      printf("%-3d %10.2f%% Percent of %s\n", index, per[index], name[index]);
  17105.  
  17106. 
  17107. File: libc,  Node: putc,  Next: putch,  Prev: printf,  Up: Alphabetical List
  17108.  
  17109. putc
  17110. ====
  17111.  
  17112. Syntax
  17113. ------
  17114.  
  17115.      #include <stdio.h>
  17116.      
  17117.      int putc(int c, FILE *file);
  17118.  
  17119. Description
  17120. -----------
  17121.  
  17122. This function writes one character to the given FILE.
  17123.  
  17124. Return Value
  17125. ------------
  17126.  
  17127. The character written.
  17128.  
  17129. Example
  17130. -------
  17131.  
  17132.      while ((c=getc(stdin)) != EOF)
  17133.        putc(c, stdout);
  17134.  
  17135. 
  17136. File: libc,  Node: putch,  Next: putchar,  Prev: putc,  Up: Alphabetical List
  17137.  
  17138. putch
  17139. =====
  17140.  
  17141. Syntax
  17142. ------
  17143.  
  17144.      #include <conio.h>
  17145.      
  17146.      int putch(int _c);
  17147.  
  17148. Description
  17149. -----------
  17150.  
  17151. Put the character _C on the screen at the current cursor position.  The
  17152. special characters return, linefeed, bell, and backspace are handled
  17153. properly, as is line wrap and scrolling.  The cursor position is
  17154. updated.
  17155.  
  17156. Return Value
  17157. ------------
  17158.  
  17159. The character is returned.
  17160.  
  17161. 
  17162. File: libc,  Node: putchar,  Next: putenv,  Prev: putch,  Up: Alphabetical List
  17163.  
  17164. putchar
  17165. =======
  17166.  
  17167. Syntax
  17168. ------
  17169.  
  17170.      #include <stdio.h>
  17171.      
  17172.      int putchar(int c);
  17173.  
  17174. Description
  17175. -----------
  17176.  
  17177. This is the same as `fputc(c, stdout)'.  *Note fputc::.
  17178.  
  17179. Return Value
  17180. ------------
  17181.  
  17182. The character written.
  17183.  
  17184. Example
  17185. -------
  17186.  
  17187.      while ((c = getchar()) != EOF)
  17188.        putchar(c);
  17189.  
  17190. 
  17191. File: libc,  Node: putenv,  Next: puts,  Prev: putchar,  Up: Alphabetical List
  17192.  
  17193. putenv
  17194. ======
  17195.  
  17196. Syntax
  17197. ------
  17198.  
  17199.      #include <stdlib.h>
  17200.      
  17201.      int putenv(const char *env);
  17202.  
  17203. Description
  17204. -----------
  17205.  
  17206. This function adds an entry to the program's environment.  The string
  17207. passed must be of the form `NAME'=`VALUE'.  Any existing value for the
  17208. environment variable is gone.
  17209.  
  17210. `putenv' will copy the string passed to it, and will automatically free
  17211. any existing string already in the environment.  Keep this in mind if
  17212. you alter the environment yourself.  The string you pass is still your
  17213. responsibility to free.  Note that most implementations will not let
  17214. you free the string you pass, resulting in memory leaks.
  17215.  
  17216. Return Value
  17217. ------------
  17218.  
  17219. Zero on success, nonzero on failure.
  17220.  
  17221. Example
  17222. -------
  17223.  
  17224.      putenv("SHELL=ksh.exe");
  17225.  
  17226. 
  17227. File: libc,  Node: puts,  Next: puttext,  Prev: putenv,  Up: Alphabetical List
  17228.  
  17229. puts
  17230. ====
  17231.  
  17232. Syntax
  17233. ------
  17234.  
  17235.      #include <stdio.h>
  17236.      
  17237.      int puts(const char *string);
  17238.  
  17239. Description
  17240. -----------
  17241.  
  17242. This function writes STRING to `stdout', and then writes a newline
  17243. character.
  17244.  
  17245. Return Value
  17246. ------------
  17247.  
  17248. Nonnegative for success, or `EOF' on error.
  17249.  
  17250. Example
  17251. -------
  17252.  
  17253.      puts("Hello, there");
  17254.  
  17255. 
  17256. File: libc,  Node: puttext,  Next: putw,  Prev: puts,  Up: Alphabetical List
  17257.  
  17258. puttext
  17259. =======
  17260.  
  17261. Syntax
  17262. ------
  17263.  
  17264.      #include <conio.h>
  17265.      
  17266.      int puttext(int _left, int _top, int _right, int _bottom, void *_source);
  17267.  
  17268. Description
  17269. -----------
  17270.  
  17271. The opposite of *Note gettext::.
  17272.  
  17273. Return Value
  17274. ------------
  17275.  
  17276. 1 on success, zero on error.
  17277.  
  17278. 
  17279. File: libc,  Node: putw,  Next: qsort,  Prev: puttext,  Up: Alphabetical List
  17280.  
  17281. putw
  17282. ====
  17283.  
  17284. Syntax
  17285. ------
  17286.  
  17287.      #include <stdio.h>
  17288.      
  17289.      int putw(int x, FILE *file);
  17290.  
  17291. Description
  17292. -----------
  17293.  
  17294. Writes a single binary word in native format to FILE.
  17295.  
  17296. Return Value
  17297. ------------
  17298.  
  17299. The value written, or `EOF' for end-of-file or error.  Since `EOF' is a
  17300. valid integer, you should use `feof' or `ferror' to detect this
  17301. situation.
  17302.  
  17303. Example
  17304. -------
  17305.  
  17306.      putw(12, stdout);
  17307.  
  17308. 
  17309. File: libc,  Node: qsort,  Next: raise,  Prev: putw,  Up: Alphabetical List
  17310.  
  17311. qsort
  17312. =====
  17313.  
  17314. Syntax
  17315. ------
  17316.  
  17317.      #include <stdlib.h>
  17318.      
  17319.      void qsort(void *base, size_t numelem, size_t size,
  17320.                 int (*cmp)(const void *e1, const void *e2));
  17321.  
  17322. Description
  17323. -----------
  17324.  
  17325. This function sorts the given array in place.  BASE is the address of
  17326. the first of NUMELEM array entries, each of size SIZE bytes.  `qsort'
  17327. uses the supplied function CMP to determine the sort order for any two
  17328. elements by passing the address of the two elements and using the
  17329. function's return address.
  17330.  
  17331. The return address of the function indicates the sort order:
  17332.  
  17333. Negative
  17334.      Element E1 should come before element E2 in the resulting array.
  17335.  
  17336. Positive
  17337.      Element E1 should come after element E2 in the resulting array.
  17338.  
  17339. Zero
  17340.      It doesn't matter which element comes first in the resulting array.
  17341.  
  17342. Return Value
  17343. ------------
  17344.  
  17345. None.
  17346.  
  17347. Example
  17348. -------
  17349.  
  17350.      typedef struct {
  17351.        int size;
  17352.        int sequence;
  17353.      } Item;
  17354.      
  17355.      int qsort_helper_by_size(void *e1, void *e2)
  17356.      {
  17357.        return ((Item *)e2)->size - ((Item *)e1)->size;
  17358.      }
  17359.      
  17360.      Item list[100];
  17361.      
  17362.      qsort(list, 100, sizeof(Item), qsort_helper_by_size);
  17363.      
  17364.      int qsort_stringlist(void *e1, void *e2)
  17365.      {
  17366.        return strcmp(*(char **)e1, *(char **)e2);
  17367.      }
  17368.      
  17369.      char *slist[10];
  17370.      
  17371.      /* alphabetical order */
  17372.      qsort(slist, 10, sizeof(char *), qsort_stringlist);
  17373.  
  17374. 
  17375. File: libc,  Node: raise,  Next: rand,  Prev: qsort,  Up: Alphabetical List
  17376.  
  17377. raise
  17378. =====
  17379.  
  17380. Syntax
  17381. ------
  17382.  
  17383.      #include <signal.h>
  17384.      
  17385.      int    raise(int _sig);
  17386.  
  17387. Description
  17388. -----------
  17389.  
  17390. This function raises the given signal (see `<signal.h>' for a list).
  17391. *Note signal::.
  17392.  
  17393. Return Value
  17394. ------------
  17395.  
  17396. 0 on success.
  17397.  
  17398. 
  17399. File: libc,  Node: rand,  Next: random,  Prev: raise,  Up: Alphabetical List
  17400.  
  17401. rand
  17402. ====
  17403.  
  17404. Syntax
  17405. ------
  17406.  
  17407.      #include <stdlib.h>
  17408.      
  17409.      int rand(void);
  17410.  
  17411. Description
  17412. -----------
  17413.  
  17414. Returns a pseudo-random number from zero to `RAND_MAX'.
  17415.  
  17416. Return Value
  17417. ------------
  17418.  
  17419. The number.
  17420.  
  17421. Example
  17422. -------
  17423.  
  17424.      /* random pause */
  17425.      for (i=rand(); i; i--);
  17426.  
  17427. 
  17428. File: libc,  Node: random,  Next: rawclock,  Prev: rand,  Up: Alphabetical List
  17429.  
  17430. random
  17431. ======
  17432.  
  17433. Syntax
  17434. ------
  17435.  
  17436.      #include <stdlib.h>
  17437.      
  17438.      long random(void);
  17439.  
  17440. Description
  17441. -----------
  17442.  
  17443. Returns a random number in the range 0..MAXINT.
  17444.  
  17445. Return Value
  17446. ------------
  17447.  
  17448. 0 .. MAXINT
  17449.  
  17450. 
  17451. File: libc,  Node: rawclock,  Next: read,  Prev: random,  Up: Alphabetical List
  17452.  
  17453. rawclock
  17454. ========
  17455.  
  17456. Syntax
  17457. ------
  17458.  
  17459.      #include <time.h>
  17460.      
  17461.      unsigned long rawclock(void);
  17462.  
  17463. Description
  17464. -----------
  17465.  
  17466. Returns the number of clock tics (18.2 per second) since midnight.
  17467.  
  17468. Return Value
  17469. ------------
  17470.  
  17471. The number of tics.
  17472.  
  17473. Example
  17474. -------
  17475.  
  17476.      /* wait 1/4 second */
  17477.      int i = rawclock()+5;
  17478.      while (rawclock()<i);
  17479.  
  17480. 
  17481. File: libc,  Node: read,  Next: _read,  Prev: rawclock,  Up: Alphabetical List
  17482.  
  17483. read
  17484. ====
  17485.  
  17486. Syntax
  17487. ------
  17488.  
  17489.      #include <unistd.h>
  17490.      
  17491.      ssize_t read(int fd, void *buffer, size_t length);
  17492.  
  17493. Description
  17494. -----------
  17495.  
  17496. This function reads at most LENGTH bytes from file FD into BUFFER.
  17497. Note that in some cases, such as end-of-file conditions and text files,
  17498. it may read less than the requested number of bytes.  At end-of-file,
  17499. `read' will read exactly zero bytes.
  17500.  
  17501. Return Value
  17502. ------------
  17503.  
  17504. The number of bytes read, zero meaning end-of-file, or -1 for an error.
  17505.  
  17506. Example
  17507. -------
  17508.  
  17509.      char buf[10];
  17510.      int r = read(0, buf, 10);
  17511.  
  17512. 
  17513. File: libc,  Node: _read,  Next: readdir,  Prev: read,  Up: Alphabetical List
  17514.  
  17515. _read
  17516. =====
  17517.  
  17518. Syntax
  17519. ------
  17520.  
  17521.      #include <io.h>
  17522.      
  17523.      ssize_t _read(int fildes, void *buf, size_t nbyte);
  17524.  
  17525. Description
  17526. -----------
  17527.  
  17528. This is a direct connection to the MS-DOS read function call, int 0x21,
  17529. %ah = 0x3f.  No conversion is done on the data; it is read as raw
  17530. binary data.
  17531.  
  17532. Return Value
  17533. ------------
  17534.  
  17535. The number of bytes read.
  17536.  
  17537. 
  17538. File: libc,  Node: readdir,  Next: realloc,  Prev: _read,  Up: Alphabetical List
  17539.  
  17540. readdir
  17541. =======
  17542.  
  17543. Syntax
  17544. ------
  17545.  
  17546.      #include <dirent.h>
  17547.      
  17548.      struct dirent *readdir(DIR *dir);
  17549.  
  17550. Description
  17551. -----------
  17552.  
  17553. This function reads entries from a directory opened by `opendir' (*note
  17554. opendir::.).  It returns the information in a static buffer with this
  17555. format:
  17556.  
  17557.      struct dirent {
  17558.        unsigned short d_namlen;  /* The length of the name (like strlen) */
  17559.        char d_name[MAXNAMLEN+1]; /* The name */
  17560.      };
  17561.  
  17562. Return Value
  17563. ------------
  17564.  
  17565. A pointer to a static buffer that is overridden with each call.
  17566.  
  17567. Example
  17568. -------
  17569.  
  17570.      DIR *d = opendir(".");
  17571.      struct dirent *de;
  17572.      while (de = readdir(d))
  17573.        puts(de->d_name);
  17574.      closedir(d);
  17575.  
  17576. 
  17577. File: libc,  Node: realloc,  Next: remove,  Prev: readdir,  Up: Alphabetical List
  17578.  
  17579. realloc
  17580. =======
  17581.  
  17582. Syntax
  17583. ------
  17584.  
  17585.      #include <stdlib.h>
  17586.      
  17587.      void *realloc(void *ptr, size_t size);
  17588.  
  17589. Description
  17590. -----------
  17591.  
  17592. This function changes the size of the region pointed to by PTR.  If it
  17593. can, it will reuse the same memory space, but it may have to allocate a
  17594. new memory space to satisfy the request.  In either case, it will
  17595. return the pointer that you should use to refer to the (possibly new)
  17596. memory area.  The pointer passed may be `NULL', in which case this
  17597. function acts just like `malloc' (*note malloc::.).
  17598.  
  17599. Return Value
  17600. ------------
  17601.  
  17602. A pointer to the memory you should now refer to.
  17603.  
  17604. Example
  17605. -------
  17606.  
  17607.      if (now+new > max)
  17608.      {
  17609.        max = now+new;
  17610.        p = realloc(p, max);
  17611.      }
  17612.  
  17613. 
  17614. File: libc,  Node: remove,  Next: remque,  Prev: realloc,  Up: Alphabetical List
  17615.  
  17616. remove
  17617. ======
  17618.  
  17619. Syntax
  17620. ------
  17621.  
  17622.      #include <stdio.h>
  17623.      
  17624.      int remove(const char *file);
  17625.  
  17626. Description
  17627. -----------
  17628.  
  17629. This function removes the named FILE from the file system.  Unless you
  17630. have an un-erase program, the file and its contents are gone for good.
  17631.  
  17632. Return Value
  17633. ------------
  17634.  
  17635. Zero on success, nonzero on failure.
  17636.  
  17637. Example
  17638. -------
  17639.  
  17640.      remove("/tmp/data.tmp");
  17641.  
  17642. 
  17643. File: libc,  Node: remque,  Next: rename,  Prev: remove,  Up: Alphabetical List
  17644.  
  17645. remque
  17646. ======
  17647.  
  17648. Syntax
  17649. ------
  17650.  
  17651.      #include <search.h>
  17652.      
  17653.      void putenv(struct qelem *elem);
  17654.  
  17655. Description
  17656. -----------
  17657.  
  17658. This function manipulates queues built from doubly linked lists.  Each
  17659. element in the queue must be in the form of `struct qelem' which is
  17660. defined thus:
  17661.  
  17662.      struct qelem {
  17663.        struct qelem *q_forw;
  17664.        struct qelem *q_back;
  17665.        char q_data[0];
  17666.      }
  17667.  
  17668. This function removes the entry ELEM from a queue.
  17669.  
  17670. Return Value
  17671. ------------
  17672.  
  17673. None.
  17674.  
  17675. 
  17676. File: libc,  Node: rename,  Next: rewind,  Prev: remque,  Up: Alphabetical List
  17677.  
  17678. rename
  17679. ======
  17680.  
  17681. Syntax
  17682. ------
  17683.  
  17684.      #include <stdio.h>
  17685.      
  17686.      int rename(const char *oldname, const char *newname);
  17687.  
  17688. Description
  17689. -----------
  17690.  
  17691. This function renames an existing file or directory OLDNAME to NEWNAME.
  17692. If NEWNAME exists, then it is first removed.  If NEWNAME is a
  17693. directory, it must be empty (or else ERRNO will be set to `ENOTEMPTY'),
  17694. and must not include OLDNAME in its path prefix (otherwise, ERRNO will
  17695. be set to `EINVAL').  If NEWNAME exists, both OLDNAME and NEWNAME must
  17696. be of the same type (both directories or both regular files) (or else
  17697. ERRNO will be set to `ENOTDIR' or `EISDIR'), and must reside on the
  17698. same logical device (otherwise, ERRNO will be set to `EXDEV').
  17699. Wildcards are not allowed in either OLDNAME or NEWNAME.  DOS won't
  17700. allow renaming a current directory even on a non-default drive (you
  17701. will get the `EBUSY' or `EINVAL' in ERRNO).  `ENAMETOOLONG' will be
  17702. returned for pathnames which are longer than the limit imposed by DOS.
  17703. If OLDNAME doesn't exist, ERRNO will be set to `ENOENT'.  For most of
  17704. the other calamities, DOS will usually set ERRNO to `EACCES'.
  17705.  
  17706. If anything goes wrong during the operation of `rename()', the function
  17707. tries very hard to leave the things as ther were before it was invoked,
  17708. but it might not always succeed.
  17709.  
  17710. Return Value
  17711. ------------
  17712.  
  17713. Zero on success, nonzero on failure.
  17714.  
  17715. Example
  17716. -------
  17717.  
  17718.      rename("c:/mydir/some.doc", "c:/yourdir/some.sav");
  17719.      rename("c:/path1/mydir", "c:/path2");
  17720.  
  17721. 
  17722. File: libc,  Node: rewind,  Next: rewinddir,  Prev: rename,  Up: Alphabetical List
  17723.  
  17724. rewind
  17725. ======
  17726.  
  17727. Syntax
  17728. ------
  17729.  
  17730.      #include <stdio.h>
  17731.      
  17732.      void rewind(FILE *file);
  17733.  
  17734. Description
  17735. -----------
  17736.  
  17737. This function repositions the file pointer to the beginning of the file
  17738. and clears the error indicator.
  17739.  
  17740. Return Value
  17741. ------------
  17742.  
  17743. None.
  17744.  
  17745. Example
  17746. -------
  17747.  
  17748.      rewind(stdin);
  17749.  
  17750. 
  17751. File: libc,  Node: rewinddir,  Next: rindex,  Prev: rewind,  Up: Alphabetical List
  17752.  
  17753. rewinddir
  17754. =========
  17755.  
  17756. Syntax
  17757. ------
  17758.  
  17759.      #include <dirent.h>
  17760.      
  17761.      void rewinddir(DIR *dir);
  17762.  
  17763. Description
  17764. -----------
  17765.  
  17766. This function resets the position of the DIR so that the next call to
  17767. `readdir' (*note readdir::.) starts at the beginning again.
  17768.  
  17769. Return Value
  17770. ------------
  17771.  
  17772. None.
  17773.  
  17774. Example
  17775. -------
  17776.  
  17777.      DIR *d = opendir(".");
  17778.      rewinddir(d);
  17779.  
  17780. 
  17781. File: libc,  Node: rindex,  Next: rmdir,  Prev: rewinddir,  Up: Alphabetical List
  17782.  
  17783. rindex
  17784. ======
  17785.  
  17786. Syntax
  17787. ------
  17788.  
  17789.      #include <strings.h>
  17790.      
  17791.      char *rindex(const char *string, int ch);
  17792.  
  17793. Description
  17794. -----------
  17795.  
  17796. Returns a pointer to the last occurrence of CH in STRING.  Note that
  17797. the `NULL' character counts, so if you pass zero as CH you'll get a
  17798. pointer to the end of the string back.
  17799.  
  17800. Return Value
  17801. ------------
  17802.  
  17803. A pointer to the character, or `NULL' if it wasn't found.
  17804.  
  17805. Example
  17806. -------
  17807.  
  17808.      char *last_slash = rindex(filename, '/');
  17809.  
  17810. 
  17811. File: libc,  Node: rmdir,  Next: sbrk,  Prev: rindex,  Up: Alphabetical List
  17812.  
  17813. rmdir
  17814. =====
  17815.  
  17816. Syntax
  17817. ------
  17818.  
  17819.      #include <unistd.h>
  17820.      
  17821.      int rmdir(const char *dirname);
  17822.  
  17823. Description
  17824. -----------
  17825.  
  17826. This function removes directory DIRNAME.  The directory must be empty.
  17827.  
  17828. Return Value
  17829. ------------
  17830.  
  17831. Zero if the directory was removed, nonzero on failure.
  17832.  
  17833. Example
  17834. -------
  17835.  
  17836.      rmdir("/tmp/datadir");
  17837.  
  17838. 
  17839. File: libc,  Node: sbrk,  Next: scanf,  Prev: rmdir,  Up: Alphabetical List
  17840.  
  17841. sbrk
  17842. ====
  17843.  
  17844. Syntax
  17845. ------
  17846.  
  17847.      #include <osfcn.h>
  17848.      
  17849.      void *sbrk(int delta)
  17850.  
  17851. Description
  17852. -----------
  17853.  
  17854. This function changes the "break" of the program by adding DELTA to it.
  17855. This is the highest address that your program can access without
  17856. causing a violation.  Since the heap is the region under the break, you
  17857. can expand the heap (where `malloc' gets memory from) by increasing the
  17858. break.
  17859.  
  17860. This function is normally accessed only bu `malloc' (*note malloc::.).
  17861.  
  17862. Return Value
  17863. ------------
  17864.  
  17865. The address of the first byte outside of the previous valid address
  17866. range, or -1 if no more memory could be accessed.  In other words, a
  17867. pointer to the chunk of heap you just allocated, if you had passed a
  17868. positive number.
  17869.  
  17870. Example
  17871. -------
  17872.  
  17873.      char *buf;
  17874.      buf = sbrk(1000); /* allocate space */
  17875.  
  17876. 
  17877. File: libc,  Node: scanf,  Next: Screen Variables,  Prev: sbrk,  Up: Alphabetical List
  17878.  
  17879. scanf
  17880. =====
  17881.  
  17882. Syntax
  17883. ------
  17884.  
  17885.      #include <stdio.h>
  17886.      
  17887.      int scanf(const char *format, ...);
  17888.  
  17889. Description
  17890. -----------
  17891.  
  17892. This function scans formatted text from `stdin' and stores it in the
  17893. variables pointed to by the arguments.  *Note scanf::.
  17894.  
  17895. The format string contains regular characters which much match the input
  17896. exactly as well as a conversion specifiers, which begin with a percent
  17897. symbol.  Any whitespace in the format string matches zero or more of any
  17898. whitespace characters in the input.  Thus, a single space may match a
  17899. newline and two tabs in the input.  All conversions except `c' and `['
  17900. also skip leading whitespace automatically.  Each conversion specifier
  17901. contains the following fields:
  17902.  
  17903.    *  An asterisk (`*') which indicates that the input should be
  17904.      converted according to the conversion spec, but not stored
  17905.      anywhere.
  17906.  
  17907.    *  A width specifier, which specifies the maximum number of input
  17908.      characters to use in the conversion.
  17909.  
  17910.    *  An optional conversion qualifier, which may be `h' to specify
  17911.      `short', `l' to specify long ints, or `L' to specify long doubles.
  17912.  
  17913.    *  The conversion type specifier:
  17914.  
  17915.     `c'
  17916.           Copy the next character (or WIDTH characters) to the given
  17917.           buffer.
  17918.  
  17919.     `d'
  17920.           Convert the input to a signed integer.
  17921.  
  17922.     `e'
  17923.     `E'
  17924.     `f'
  17925.     `g'
  17926.     `G'
  17927.           Convert the input to a floating point number.
  17928.  
  17929.     `i'
  17930.           Convert the input, determining base automatically by the
  17931.           presence of `0x' or `0' prefixes.  *Note strtol::.
  17932.  
  17933.     `n'
  17934.           Store the number of characters scanned so far into the
  17935.           integer pointed to.
  17936.  
  17937.     `o'
  17938.           Convert the input to a signed integer, using base 8.
  17939.  
  17940.     `p'
  17941.           Convert the input to a pointer.  This is like using the `x'
  17942.           format.
  17943.  
  17944.     `s'
  17945.           Copy the input to the given string, skipping leading
  17946.           whitespace and copying non-whitespace characters up to the
  17947.           next whitespace.  The string stored is then `NULL'-terminated.
  17948.  
  17949.     `u'
  17950.           Convert the input to an unsigned integer.
  17951.  
  17952.     `x'
  17953.     `X'
  17954.           Convert the input to an unsigned integer, using base 16.
  17955.  
  17956.     `[...]'
  17957.           Like the `c' format, except only certain characters are
  17958.           copied.  The characters between the brackets determine which
  17959.           characters are allowed, and thus when the copying stops.
  17960.           These characters may be regular characters (example:
  17961.           `[abcd]') or a range of characters (example: `[a-d]').  If
  17962.           the first character is a caret (`^'), then the set specifies
  17963.           the set of characters that do not get copied (i.e.  the set
  17964.           is negated).  To specify that the set contains a
  17965.           close-bracket (`]'), list that as the first regular character.
  17966.  
  17967.     `%'
  17968.           This must match a percent character in the input.
  17969.  
  17970. Most conversions make use of `strtol' or `strtoul' to perform the
  17971. actual conversions.
  17972.  
  17973. Return Value
  17974. ------------
  17975.  
  17976. The number of items successfully scanned.
  17977.  
  17978. Example
  17979. -------
  17980.  
  17981.      int x, y;
  17982.      char buf[100];
  17983.      scanf("%d %d %s", &x, &y, buf);
  17984.      
  17985.      /* read to end-of-line */
  17986.      scanf("%d %[^\n]\n", &x, buf);
  17987.      /* read letters only */
  17988.      scanf("[a-zA-Z]", buf);
  17989.  
  17990. 
  17991. File: libc,  Node: Screen Variables,  Next: ScreenClear,  Prev: scanf,  Up: Alphabetical List
  17992.  
  17993. Screen Variables
  17994. ================
  17995.  
  17996. Syntax
  17997. ------
  17998.  
  17999.      #include <go32.h>
  18000.      #include <pc.h>
  18001.      
  18002.      unsigned long ScreenPrimary;
  18003.      unsigned long ScreenSecondary;
  18004.      extern unsigned char ScreenAttrib;
  18005.  
  18006. Description
  18007. -----------
  18008.  
  18009. The first two variables (actually, they are #define'd aliases to fields
  18010. in the _GO32_INFO_BLOCK structure *note _go32_info_block::.) allow
  18011. access to the video memory of the primary and secondary screens as if
  18012. they were arrays.  To reference them, you must use
  18013. dosmemget()/dosmemput() functions (*Note dosmemget::, *Note
  18014. dosmemput::) or any one of the far pointer functions (*note _far*::.),
  18015. as the video memory is *not* mapped into your default address space.
  18016.  
  18017. The variable ScreenAttrib holds the current attribute which is in use by
  18018. the text screen writes.  The attribute is constructed as follows:
  18019.  
  18020. bits 0-3  - foreground color;
  18021.  
  18022. bits 4-6  - background color;
  18023.  
  18024. bit  7    - blink on (1) or off (0).
  18025.  
  18026. Example
  18027. -------
  18028.  
  18029. _farpokew(_dos_ds, ScreenPrimary, ( ((unsigned short) attr) << 8) +
  18030. char ));
  18031.  
  18032.  
  18033. 
  18034. File: libc,  Node: ScreenClear,  Next: ScreenCols,  Prev: Screen Variables,  Up: Alphabetical List
  18035.  
  18036. ScreenClear
  18037. ===========
  18038.  
  18039. Syntax
  18040. ------
  18041.  
  18042.      #include <pc.h>
  18043.      
  18044.      void  ScreenClear(void);
  18045.  
  18046. Description
  18047. -----------
  18048.  
  18049. This function clears the text screen.  It overwrites it by blanks with
  18050. the current background and foreground as specified by ScreenAttrib
  18051. (*note Screen Variables::.).
  18052.  
  18053. Return Value
  18054. ------------
  18055.  
  18056. None.
  18057.  
  18058. Example
  18059. -------
  18060.  
  18061.      ScreenClear();
  18062.  
  18063. 
  18064. File: libc,  Node: ScreenCols,  Next: ScreenGetCursor,  Prev: ScreenClear,  Up: Alphabetical List
  18065.  
  18066. ScreenCols
  18067. ==========
  18068.  
  18069. Syntax
  18070. ------
  18071.  
  18072.      #include <pc.h>
  18073.      
  18074.      int ScreenCols(void);
  18075.  
  18076. Description
  18077. -----------
  18078.  
  18079. This function returns the number of columns of the screen.  It does so
  18080. by looking at the byte at the absolute address 40:4Ah in the BIOS area.
  18081. In text modes, the meaning of number of columns is obvious; in graphics
  18082. modes, this value is the number of columns of text available when using
  18083. the video BIOS functions to write text.
  18084.  
  18085. Return Value
  18086. ------------
  18087.  
  18088. The number of columns.
  18089.  
  18090. Example
  18091. -------
  18092.  
  18093.  
  18094.      int available_columns = ScreenCols();
  18095.  
  18096. 
  18097. File: libc,  Node: ScreenGetCursor,  Next: ScreenMode,  Prev: ScreenCols,  Up: Alphabetical List
  18098.  
  18099. ScreenGetCursor
  18100. ===============
  18101.  
  18102. Syntax
  18103. ------
  18104.  
  18105.      #include <pc.h>
  18106.      
  18107.      void  ScreenGetCursor(int *row, int *column);
  18108.  
  18109. Description
  18110. -----------
  18111.  
  18112. This function retrieves the current cursor position of the default video
  18113. page by calling function 3 of the interrupt 10h, and stores it in the
  18114. variables pointed by ROW and COLUMN.
  18115.  
  18116. Return Value
  18117. ------------
  18118.  
  18119. None.
  18120.  
  18121. Example
  18122. -------
  18123.  
  18124.      ScreenGetCursor(&wherex, &wherey);
  18125.  
  18126. 
  18127. File: libc,  Node: ScreenMode,  Next: ScreenPutChar,  Prev: ScreenGetCursor,  Up: Alphabetical List
  18128.  
  18129. ScreenMode
  18130. ==========
  18131.  
  18132. Syntax
  18133. ------
  18134.  
  18135.      #include <pc.h>
  18136.      
  18137.      int  ScreenMode(void);
  18138.  
  18139. Description
  18140. -----------
  18141.  
  18142. This function reports the current video mode as known to the system
  18143. BIOS.  It does so by accessing the byte at absolute address 40:49h.
  18144.  
  18145. Return Value
  18146. ------------
  18147.  
  18148. The video mode.
  18149.  
  18150. Example
  18151. -------
  18152.  
  18153.      video_mode = ScreenMode();
  18154.  
  18155. 
  18156. File: libc,  Node: ScreenPutChar,  Next: ScreenPutString,  Prev: ScreenMode,  Up: Alphabetical List
  18157.  
  18158. ScreenPutChar
  18159. =============
  18160.  
  18161. Syntax
  18162. ------
  18163.  
  18164.      #include <pc.h>
  18165.      
  18166.      void  ScreenPutChar(int ch, int attr, int col, int row);
  18167.  
  18168. Description
  18169. -----------
  18170.  
  18171. This function writes the character whose value is specified in CH with
  18172. an attribute ATTR at row given by ROW and column given by COL, which
  18173. are zero-based.  It does so by directly accessing the video memory, so
  18174. it will only work when the screen is in text mode.
  18175.  
  18176. Return Value
  18177. ------------
  18178.  
  18179. None.
  18180.  
  18181. Example
  18182. -------
  18183.  
  18184.      ScreenPutChar('R', (BLUE << 4) | LIGHTMAGENTA, 75, 0);
  18185.  
  18186. 
  18187. File: libc,  Node: ScreenPutString,  Next: ScreenRetrieve,  Prev: ScreenPutChar,  Up: Alphabetical List
  18188.  
  18189. ScreenPutString
  18190. ===============
  18191.  
  18192. Syntax
  18193. ------
  18194.  
  18195.      #include <pc.h>
  18196.      
  18197.      void  ScreenPutString(const char *str, int attr, int column, int row);
  18198.  
  18199. Description
  18200. -----------
  18201.  
  18202. Beginning at screen position given by COLUMN and ROW, this function
  18203. displays the string given by STR.  Each string character gets the
  18204. attribute given by ATTR.  If COLUMN or ROW have values outside legal
  18205. range for current video mode, nothing happens.  The variables ROW and
  18206. COLUMN are zero-based (e.g., the topmost row is row 0).
  18207.  
  18208. Return Value
  18209. ------------
  18210.  
  18211. None.
  18212.  
  18213. Example
  18214. -------
  18215.  
  18216.      ScreenPutString("Hello, world!", (BLUE << 4) | LIGHTBLUE, 20, 10);
  18217.  
  18218. 
  18219. File: libc,  Node: ScreenRetrieve,  Next: ScreenRows,  Prev: ScreenPutString,  Up: Alphabetical List
  18220.  
  18221. ScreenRetrieve
  18222. ==============
  18223.  
  18224. Syntax
  18225. ------
  18226.  
  18227.      #include <pc.h>
  18228.      
  18229.      void  ScreenRetrieve(void *buf);
  18230.  
  18231. Description
  18232. -----------
  18233.  
  18234. This function stores a replica of the current primary screen contents in
  18235. the buffer pointed to by BUF.  It assumes without checking that BUF has
  18236. enough storage to hold the data.  The required storage can be computed
  18237. as `ScreenRows()*ScreenCols()*2' (*Note ScreenRows::, *Note
  18238. ScreenCols::).
  18239.  
  18240. Return Value
  18241. ------------
  18242.  
  18243. None.
  18244.  
  18245. Example
  18246. -------
  18247.  
  18248.      unsigned *saved_screen = (unsigned *)alloca(ScreenRows()*ScreenCols()*2;
  18249.      
  18250.      ScreenRetrieve(saved_screen);
  18251.  
  18252. 
  18253. File: libc,  Node: ScreenRows,  Next: ScreenSetCursor,  Prev: ScreenRetrieve,  Up: Alphabetical List
  18254.  
  18255. ScreenRows
  18256. ==========
  18257.  
  18258. Syntax
  18259. ------
  18260.  
  18261.      #include <pc.h>
  18262.      
  18263.      int ScreenRows(void);
  18264.  
  18265. Description
  18266. -----------
  18267.  
  18268. This function returns the number of rows of the text screen.  It does so
  18269. by looking at the byte at the absolute address 40:84h in the BIOS area.
  18270. This method works only for video adapters with their own BIOS
  18271. extensions, like EGA, VGA, SVGA etc.
  18272.  
  18273. Return Value
  18274. ------------
  18275.  
  18276. The number of rows.
  18277.  
  18278. Example
  18279. -------
  18280.  
  18281.  
  18282.      int rows = ScreenRows();
  18283.  
  18284. 
  18285. File: libc,  Node: ScreenSetCursor,  Next: ScreenUpdate,  Prev: ScreenRows,  Up: Alphabetical List
  18286.  
  18287. ScreenSetCursor
  18288. ===============
  18289.  
  18290. Syntax
  18291. ------
  18292.  
  18293.      #include <pc.h>
  18294.      
  18295.      void  ScreenSetCursor(int  row, int  column);
  18296.  
  18297. Description
  18298. -----------
  18299.  
  18300. This function moves the cursor position on the default video page to the
  18301. point given by (zero-based) ROW and COLUMN, by calling function 2 of
  18302. interrupt 10h.
  18303.  
  18304. Return Value
  18305. ------------
  18306.  
  18307. None.
  18308.  
  18309. Example
  18310. -------
  18311.  
  18312.      ScreenSetCursor(0, 0);   /* home the cursor */
  18313.  
  18314. 
  18315. File: libc,  Node: ScreenUpdate,  Next: ScreenUpdateLine,  Prev: ScreenSetCursor,  Up: Alphabetical List
  18316.  
  18317. ScreenUpdate
  18318. ============
  18319.  
  18320. Syntax
  18321. ------
  18322.  
  18323.      #include <pc.h>
  18324.      
  18325.      void  ScreenUpdate(void *buf);
  18326.  
  18327. Description
  18328. -----------
  18329.  
  18330. This function writes the contents of the buffer BUF to the primary
  18331. screen.  The buffer should contain an exact replica of the video memory,
  18332. including the characters and their attributes.
  18333.  
  18334. Return Value
  18335. ------------
  18336.  
  18337. None.
  18338.  
  18339. Example
  18340. -------
  18341.  
  18342.      ScreenUpdate(saved_screen);
  18343.  
  18344. 
  18345. File: libc,  Node: ScreenUpdateLine,  Next: ScreenVisualBell,  Prev: ScreenUpdate,  Up: Alphabetical List
  18346.  
  18347. ScreenUpdateLine
  18348. ================
  18349.  
  18350. Syntax
  18351. ------
  18352.  
  18353.      #include <pc.h>
  18354.      
  18355.      void  ScreenUpdateLine(void *buf, int row);
  18356.  
  18357. Description
  18358. -----------
  18359.  
  18360. This function writes the contents of BUF to the screen line number
  18361. given in ROW (the topmost line is row 0), on the primary screen.
  18362.  
  18363. Return Value
  18364. ------------
  18365.  
  18366. None.
  18367.  
  18368. Example
  18369. -------
  18370.  
  18371.      ScreenUpdateLine(line_buf, 10);
  18372.  
  18373. 
  18374. File: libc,  Node: ScreenVisualBell,  Next: searchpath,  Prev: ScreenUpdateLine,  Up: Alphabetical List
  18375.  
  18376. ScreenVisualBell
  18377. ================
  18378.  
  18379. Syntax
  18380. ------
  18381.  
  18382.      #include <pc.h>
  18383.      
  18384.      void  ScreenVisualBell(void);
  18385.  
  18386. Description
  18387. -----------
  18388.  
  18389. This function flashes the screen colors to produce the effect of "visual
  18390. bell'.  It does so by momentarily inverting the colors of every
  18391. character on the screen.
  18392.  
  18393. Return Value
  18394. ------------
  18395.  
  18396. None.
  18397.  
  18398. Example
  18399. -------
  18400.  
  18401.      ScreenVisualBell();
  18402.  
  18403. 
  18404. File: libc,  Node: searchpath,  Next: seekdir,  Prev: ScreenVisualBell,  Up: Alphabetical List
  18405.  
  18406. searchpath
  18407. ==========
  18408.  
  18409. Syntax
  18410. ------
  18411.  
  18412.      #include <dir.h>
  18413.      
  18414.      char * searchpath(const char *file);
  18415.  
  18416. Description
  18417. -----------
  18418.  
  18419. Given a name of a file in FILE, searches for that file in a list of
  18420. directories, including the current working directory and those defined
  18421. in the PATH environment variable.
  18422.  
  18423. Return Value
  18424. ------------
  18425.  
  18426. When successfull, the function returns a pointer to a static buffer
  18427. where the full pathname of the found file is stored.  Otherwise, it
  18428. returns NULL.
  18429.  
  18430. Example
  18431. -------
  18432.  
  18433.        printf("%s was found as %s\n", argv[1], searchpath(argv[1]));
  18434.  
  18435. 
  18436. File: libc,  Node: seekdir,  Next: select,  Prev: searchpath,  Up: Alphabetical List
  18437.  
  18438. seekdir
  18439. =======
  18440.  
  18441. Syntax
  18442. ------
  18443.  
  18444.      #include <dirent.h>
  18445.      
  18446.      void seekdir(DIR *dir, long loc);
  18447.  
  18448. Description
  18449. -----------
  18450.  
  18451. This function sets the location pointer in DIR to the specified LOC.
  18452. Note that the value used for LOC should be either zero or a value
  18453. returned by `telldir' (*note telldir::.).  The next call to `readdir'
  18454. (*note readdir::.) will read whatever entry follows that point in the
  18455. directory.
  18456.  
  18457. Return Value
  18458. ------------
  18459.  
  18460. None.
  18461.  
  18462. Example
  18463. -------
  18464.  
  18465.      int q = telldir(dir);
  18466.      do_stuff();
  18467.      seekdir(dir, q);
  18468.  
  18469. 
  18470. File: libc,  Node: select,  Next: _set_screen_lines,  Prev: seekdir,  Up: Alphabetical List
  18471.  
  18472. select
  18473. ======
  18474.  
  18475. Syntax
  18476. ------
  18477.  
  18478.      #include <time.h>
  18479.      
  18480.      int
  18481.      select(int nfds,
  18482.          fd_set *readfds,
  18483.          fd_set *writefds,
  18484.          fd_set *exceptfds,
  18485.          struct timeval *timeout)
  18486.  
  18487. Description
  18488. -----------
  18489.  
  18490. This function waits for files to be ready for input or output, or for a
  18491. timeout.  Each fd_set represents a set of bits representing file
  18492. descriptors.  The following macros shall be used to deal with these
  18493. sets:
  18494.  
  18495. `FD_ZERO(p)'
  18496.      Initialize the set to all zeros.
  18497.  
  18498. `FD_SET(n, p)'
  18499.      Set member N in set P.
  18500.  
  18501. `FD_CLR(n, p)'
  18502.      Clear member N in set P.
  18503.  
  18504. `FD_ISSET(n, p)'
  18505.      Return the value of member N in set P.
  18506.  
  18507. The TIMEOUT value may be a NULL pointer (no timeout), a pointer to a
  18508. zero-value structure (poll mode), or a pointer to an interval-filled
  18509. structure (timeout).
  18510.  
  18511. Return Value
  18512. ------------
  18513.  
  18514. The number of files ready.  The input sets are replaced with sets that
  18515. describe which files are ready for which operations.
  18516.  
  18517. 
  18518. File: libc,  Node: _set_screen_lines,  Next: setbuf,  Prev: select,  Up: Alphabetical List
  18519.  
  18520. _set_screen_lines
  18521. =================
  18522.  
  18523. Syntax
  18524. ------
  18525.  
  18526.      #include <conio.h>
  18527.      void _set_screen_lines(int nlines);
  18528.  
  18529. Description
  18530. -----------
  18531.  
  18532. This function sets the text screen width to 80 and its height to the
  18533. value given by NLINES, which can be one of the following: 25, 28, 35,
  18534. 40, 43 or 50.  On a CGA, only 25-line screen is supported.  On an EGA,
  18535. you can use 25, 35 and 43.  VGA, PGA and MCGA support all of the
  18536. possible dimensions.  The number of columns (i.e., screen width) is 80
  18537. for all of the above resolutions, because the standard EGA/VGA has no
  18538. way of changing it.  After this function returns, calls to
  18539. `gettextinfo()' will return the actual screen dimensions as set by
  18540. `_set_screen_lines()'.  That is, you can e.g. test whether
  18541. `_set_screen_lines()' succeeded by checking the screen height returned
  18542. by `gettextinfo()' against the desired height.  This function has a
  18543. side effect of erasing the screen contents, so application programs
  18544. which use it should make their own arrangements to redisplay it.
  18545.  
  18546. 
  18547. File: libc,  Node: setbuf,  Next: setbuffer,  Prev: _set_screen_lines,  Up: Alphabetical List
  18548.  
  18549. setbuf
  18550. ======
  18551.  
  18552. Syntax
  18553. ------
  18554.  
  18555.      #include <stdio.h>
  18556.      
  18557.      void setbuf(FILE *file, char *buffer);
  18558.  
  18559. Description
  18560. -----------
  18561.  
  18562. This function modifies the buffering characteristics of FILE.  First,
  18563. if the file already has a buffer, it is freed.  If there was any
  18564. pending data in it, it is lost, so this function should only be used
  18565. immediately after a call to `fopen'.
  18566.  
  18567. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  18568. non-`NULL' buffer is passed, it must be at least `BUFSIZ' bytes in
  18569. size, and the file is set to fully buffered.
  18570.  
  18571. *Note setbuffer::.  *Note setlinebuf::.  *Note setvbuf::.
  18572.  
  18573. Return Value
  18574. ------------
  18575.  
  18576. None.
  18577.  
  18578. Example
  18579. -------
  18580.  
  18581.      setbuf(stdout, malloc(BUFSIZ));
  18582.  
  18583. 
  18584. File: libc,  Node: setbuffer,  Next: setcbrk,  Prev: setbuf,  Up: Alphabetical List
  18585.  
  18586. setbuffer
  18587. =========
  18588.  
  18589. Syntax
  18590. ------
  18591.  
  18592.      #include <stdio.h>
  18593.      
  18594.      void setbuffer(FILE *file, char *buffer, int length);
  18595.  
  18596. Description
  18597. -----------
  18598.  
  18599. This function modifies the buffering characteristics of FILE.  First,
  18600. if the file already has a buffer, it is freed.  If there was any
  18601. pending data in it, it is lost, so this function should only be used
  18602. immediately after a call to `fopen'.
  18603.  
  18604. If the BUFFER passed is `NULL', the file is set to unbuffered.  If a
  18605. non-`NULL' buffer is passed, it must be at least SIZE bytes in size,
  18606. and the file is set to fully buffered.
  18607.  
  18608. *Note setbuf::.  *Note setlinebuf::.  *Note setvbuf::.
  18609.  
  18610. Return Value
  18611. ------------
  18612.  
  18613. None.
  18614.  
  18615. Example
  18616. -------
  18617.  
  18618.      setbuffer(stdout, malloc(10000), 10000);
  18619.  
  18620. 
  18621. File: libc,  Node: setcbrk,  Next: _setcursortype,  Prev: setbuffer,  Up: Alphabetical List
  18622.  
  18623. setcbrk
  18624. =======
  18625.  
  18626. Syntax
  18627. ------
  18628.  
  18629.      #include <dos.h>
  18630.      
  18631.      void setcbrk(int check);
  18632.  
  18633. Description
  18634. -----------
  18635.  
  18636. Set the setting of the Ctrl-Break checking flag in MS-DOS.  If CHECK is
  18637. zero, checking is not done.  If nonzero, checking is done.
  18638.  
  18639. Return Value
  18640. ------------
  18641.  
  18642. None.
  18643.  
  18644. 
  18645. File: libc,  Node: _setcursortype,  Next: setdate,  Prev: setcbrk,  Up: Alphabetical List
  18646.  
  18647. _setcursortype
  18648. ==============
  18649.  
  18650. Syntax
  18651. ------
  18652.  
  18653.      #include <conio.h>
  18654.      
  18655.      void _setcursortype(int _type);
  18656.  
  18657. Description
  18658. -----------
  18659.  
  18660. Sets the cursor type.  _TYPE is one of the following:
  18661.  
  18662. `_NOCURSOR'
  18663.      No cursor is displayed.
  18664.  
  18665. `_SOLIDCURSOR'
  18666.      A solid block is displayed.
  18667.  
  18668. `_NORMALCURSOR'
  18669.      An underline cursor is displayed.
  18670.  
  18671. 
  18672. File: libc,  Node: setdate,  Next: setdisk,  Prev: _setcursortype,  Up: Alphabetical List
  18673.  
  18674. setdate
  18675. =======
  18676.  
  18677. Syntax
  18678. ------
  18679.  
  18680.      #include <dos.h>
  18681.      
  18682.      void setdate(struct date *ptr);
  18683.  
  18684. Description
  18685. -----------
  18686.  
  18687. This function sets the current time.
  18688.  
  18689. *Note getdate::. *Note settime::.
  18690.  
  18691. Return Value
  18692. ------------
  18693.  
  18694. None.
  18695.  
  18696. Example
  18697. -------
  18698.  
  18699.      struct date d;
  18700.      setdate(&d);
  18701.  
  18702. 
  18703. File: libc,  Node: setdisk,  Next: setenv,  Prev: setdate,  Up: Alphabetical List
  18704.  
  18705. setdisk
  18706. =======
  18707.  
  18708. Syntax
  18709. ------
  18710.  
  18711.      #include <dir.h>
  18712.      
  18713.      int setdisk(int drive);
  18714.  
  18715. Description
  18716. -----------
  18717.  
  18718. This function sets the current disk (0=A).
  18719.  
  18720. *Note getdisk::
  18721.  
  18722. Return Value
  18723. ------------
  18724.  
  18725. The total number of possible drives.
  18726.  
  18727. Example
  18728. -------
  18729.  
  18730.      printf("There are %d drives\n", setdisk(getdisk()));
  18731.  
  18732. 
  18733. File: libc,  Node: setenv,  Next: setftime,  Prev: setdisk,  Up: Alphabetical List
  18734.  
  18735. setenv
  18736. ======
  18737.  
  18738. Syntax
  18739. ------
  18740.  
  18741.      #include <stdlib.h>
  18742.      
  18743.      int setenv(const char *name, const char *value, int rewrite);
  18744.  
  18745. Description
  18746. -----------
  18747.  
  18748. This function sets the environment variable NAME to VALUE.  If REWRITE
  18749. is set, then this function will replace any existing value.  If it is
  18750. not set, it will only put the variable into the environment if that
  18751. variable isn't already defined.
  18752.  
  18753. Return Value
  18754. ------------
  18755.  
  18756. Zero on success, -1 on failure.
  18757.  
  18758. 
  18759. File: libc,  Node: setftime,  Next: setgrent,  Prev: setenv,  Up: Alphabetical List
  18760.  
  18761. setftime
  18762. ========
  18763.  
  18764. Syntax
  18765. ------
  18766.  
  18767.      #include <dos.h>
  18768.      
  18769.      int setftime(int handle, struct ftime *ftimep);
  18770.  
  18771. Description
  18772. -----------
  18773.  
  18774. This function sets the modification time of a file.  Note that since
  18775. writing to a file, and closing a file opened for writing, also sets the
  18776. modification time, you should only use this function on files opened for
  18777. reading.
  18778.  
  18779. *Note getftime::.
  18780.  
  18781. Return Value
  18782. ------------
  18783.  
  18784. Zero on success, nonzero on failure.
  18785.  
  18786. Example
  18787. -------
  18788.  
  18789.      int q = open("data.txt", O_RDONLY);
  18790.      struct ftime f;
  18791.      f.ft_sec = f.ft_min = f.ft_hour = f.ft_day = f.ft_month = f.ft_year = 0;
  18792.      setftime(q, &f);
  18793.      close(q);
  18794.  
  18795. 
  18796. File: libc,  Node: setgrent,  Next: setitimer,  Prev: setftime,  Up: Alphabetical List
  18797.  
  18798. setgrent
  18799. ========
  18800.  
  18801. Syntax
  18802. ------
  18803.  
  18804.      #include <grp.h>
  18805.      
  18806.      void setgrent(void);
  18807.  
  18808. Description
  18809. -----------
  18810.  
  18811. This function should be called before any call to `getgrent',
  18812. `getgrgid', or `getgrnam', to start searching the groups' list from the
  18813. beginning.  *Note getgrent::.
  18814.  
  18815. Return Value
  18816. ------------
  18817.  
  18818. None.
  18819.  
  18820. 
  18821. File: libc,  Node: setitimer,  Next: setjmp,  Prev: setgrent,  Up: Alphabetical List
  18822.  
  18823. setitimer
  18824. =========
  18825.  
  18826. Syntax
  18827. ------
  18828.  
  18829.      #include <sys/time.h>
  18830.      
  18831.      struct itimerval {
  18832.        struct timeval it_interval;    /* timer interval */
  18833.        struct timeval it_value;       /* current value */
  18834.      };
  18835.      
  18836.      int setitimer(int which, struct itimerval *value, struct itimerval *ovalue);
  18837.  
  18838. Description
  18839. -----------
  18840.  
  18841. Each process has two interval timers, ITIMER_REAL and ITIMER_PROF, which
  18842. signal SIGALRM and SIGPROF respectively.  These are typically used to
  18843. provide alarm() and profiling capabilities.
  18844.  
  18845. This function changes the current value of the interval timer specified
  18846. by WHICH to the values in structure VALUE.  The previous value of the
  18847. timer is returned if OVALUE is not NULL.  When the timer expires the
  18848. appropriate signal is raised.
  18849.  
  18850. A timer is defined by the itimerval structure.  If it_value is non-zero
  18851. it specifies the time to the next timer expiration.  If it_interval is
  18852. non-zero it specifies the value to reload into it_value on timer
  18853. expiration.  Setting it_value to zero disables a timer.  Setting
  18854. it_interval to zero causes the timer to only happen once instead of
  18855. repeating.
  18856.  
  18857. Return Value
  18858. ------------
  18859.  
  18860. Returns 0 on success, -1 on failure (and sets errno).
  18861.  
  18862. 
  18863. File: libc,  Node: setjmp,  Next: setlinebuf,  Prev: setitimer,  Up: Alphabetical List
  18864.  
  18865. setjmp
  18866. ======
  18867.  
  18868. Syntax
  18869. ------
  18870.  
  18871.      #include <setjmp.h>
  18872.      
  18873.      int setjmp(jmp_buf j);
  18874.  
  18875. Description
  18876. -----------
  18877.  
  18878. This function stores the complete CPU state into J.  This information
  18879. is complete enough that `longjmp' (*note longjmp::.) can return the
  18880. program to that state.  It is also complete enough to implement
  18881. coroutines.
  18882.  
  18883. Return Value
  18884. ------------
  18885.  
  18886. This function will return zero if it is returning from it's own call.
  18887. If longjmp is used to restore the state, it will return whatever value
  18888. was passed to longjmp, except if zero is passed to longjmp it will
  18889. return one.
  18890.  
  18891. Example
  18892. -------
  18893.  
  18894.      jmp_buf j;
  18895.      if (setjmp(j))
  18896.        return;
  18897.      do_something();
  18898.      longjmp(j);
  18899.  
  18900. 
  18901. File: libc,  Node: setlinebuf,  Next: setlocale,  Prev: setjmp,  Up: Alphabetical List
  18902.  
  18903. setlinebuf
  18904. ==========
  18905.  
  18906. Syntax
  18907. ------
  18908.  
  18909.      #include <stdio.h>
  18910.      
  18911.      void setlinebuf(FILE *file);
  18912.  
  18913. Description
  18914. -----------
  18915.  
  18916. This function modifies the buffering characteristics of FILE.  First,
  18917. if the file already has a buffer, it is freed.  If there was any
  18918. pending data in it, it is lost, so this function should only be used
  18919. immediately after a call to `fopen'.
  18920.  
  18921. Next, a buffer is allocated and the file is set to line buffering.
  18922.  
  18923. *Note setbuf::.  *Note setlinebuf::.  *Note setvbuf::.
  18924.  
  18925. Return Value
  18926. ------------
  18927.  
  18928. None.
  18929.  
  18930. Example
  18931. -------
  18932.  
  18933.      setlinebuf(stderr);
  18934.  
  18935. 
  18936. File: libc,  Node: setlocale,  Next: setmntent,  Prev: setlinebuf,  Up: Alphabetical List
  18937.  
  18938. setlocale
  18939. =========
  18940.  
  18941. Syntax
  18942. ------
  18943.  
  18944.      #include <locale.h>
  18945.      
  18946.      char *setlocale(int category, const char *locale);
  18947.  
  18948. Description
  18949. -----------
  18950.  
  18951. This function sets part or all of the current locale.  The CATEGORY is
  18952. one of the following:
  18953.  
  18954. `LC_ALL'
  18955.      Set all parts of the locale.
  18956.  
  18957. `LC_COLLATE'
  18958.      Set the collating information.
  18959.  
  18960. `LC_CTYPE'
  18961.      Set the character type information.
  18962.  
  18963. `LC_MONETARY'
  18964.      Set the monetary formatting information.
  18965.  
  18966. `LC_NUMERIC'
  18967.      Set the numeric formatting information.
  18968.  
  18969. `LC_TIME'
  18970.      Set the time formatting information.
  18971.  
  18972. The LOCALE should be the name of the current locale.  Currently, only
  18973. the "C" and "POSIX" locales are supported.  If the LOCALE is NULL, no
  18974. action is performed.  If LOCALE is "", the locale is identified by
  18975. environment variables (currently not supported).
  18976.  
  18977. *Note localeconv::.
  18978.  
  18979. Return Value
  18980. ------------
  18981.  
  18982. A static string naming the current locale for the given category, or
  18983. NULL if the requested locale is not supported.
  18984.  
  18985. Example
  18986. -------
  18987.  
  18988.      setlocale(LC_ALL, "C");
  18989.  
  18990. 
  18991. File: libc,  Node: setmntent,  Next: setmode,  Prev: setlocale,  Up: Alphabetical List
  18992.  
  18993. setmntent
  18994. =========
  18995.  
  18996. Syntax
  18997. ------
  18998.  
  18999.      #include <mntent.h>
  19000.      
  19001.      FILE *setmntent(char *filename, char *type);
  19002.  
  19003. Description
  19004. -----------
  19005.  
  19006. This function returns an open FILE* pointer which can be used by
  19007. getmntent (*note getmntent::.).
  19008.  
  19009. Return Value
  19010. ------------
  19011.  
  19012. The FILE* pointer is returned.  For MS-DOS, this FILE* is not a real
  19013. pointer and may only be used by `getmntent'.
  19014.  
  19015. 
  19016. File: libc,  Node: setmode,  Next: setpgid,  Prev: setmntent,  Up: Alphabetical List
  19017.  
  19018. setmode
  19019. =======
  19020.  
  19021. Syntax
  19022. ------
  19023.  
  19024.      #include <io.h>
  19025.      
  19026.      int setmode(int file, int mode);
  19027.  
  19028. Description
  19029. -----------
  19030.  
  19031. This function sets the mode of the given FILE to MODE, which is either
  19032. `O_TEXT' or `O_BINARY'.  It will also set the file into either cooked
  19033. or raw mode accordingly, and set any `FILE*' objects that use this file
  19034. into text or binary mode.
  19035.  
  19036. Note that, for buffered streams (`FILE*'), you must call `fflush'
  19037. (*note fflush::.) before `setmode', or call `setmode' before writing
  19038. anything to the file, for proper operation.
  19039.  
  19040. Return Value
  19041. ------------
  19042.  
  19043. When successful, the function will return the previous mode of the
  19044. given FILE.  In case of failure, -1 is returned and ERRNO is set.
  19045.  
  19046. Example
  19047. -------
  19048.  
  19049.      setmode(0, O_BINARY);
  19050.  
  19051. 
  19052. File: libc,  Node: setpgid,  Next: setpwent,  Prev: setmode,  Up: Alphabetical List
  19053.  
  19054. setpgid
  19055. =======
  19056.  
  19057. Syntax
  19058. ------
  19059.  
  19060.      #include <unistd.h>
  19061.      
  19062.      int setpgid(pid_t _pid, pid_t _pgid);
  19063.  
  19064. Return Value
  19065. ------------
  19066.  
  19067. -1 (EPERM) if _pgid is not your current pid, else zero.
  19068.  
  19069. 
  19070. File: libc,  Node: setpwent,  Next: settime,  Prev: setpgid,  Up: Alphabetical List
  19071.  
  19072. setpwent
  19073. ========
  19074.  
  19075. Syntax
  19076. ------
  19077.  
  19078.      #include <pwd.h>
  19079.      
  19080.      void setpwent(void);
  19081.  
  19082. Description
  19083. -----------
  19084.  
  19085. This function reinitializes `getpwent' so that scanning will start from
  19086. the start of the list.  *Note getpwent::.
  19087.  
  19088. Return Value
  19089. ------------
  19090.  
  19091. None.
  19092.  
  19093. 
  19094. File: libc,  Node: settime,  Next: settimeofday,  Prev: setpwent,  Up: Alphabetical List
  19095.  
  19096. settime
  19097. =======
  19098.  
  19099. Syntax
  19100. ------
  19101.  
  19102.      #include <dos.h>
  19103.      
  19104.      void settime(struct time *ptr);
  19105.  
  19106. Description
  19107. -----------
  19108.  
  19109. This function sets the current time.
  19110.  
  19111. *Note gettime::. *Note setdate::.
  19112.  
  19113. Return Value
  19114. ------------
  19115.  
  19116. None.
  19117.  
  19118. Example
  19119. -------
  19120.  
  19121.      struct time t;
  19122.      settime(&t);
  19123.  
  19124. 
  19125. File: libc,  Node: settimeofday,  Next: setvbuf,  Prev: settime,  Up: Alphabetical List
  19126.  
  19127. settimeofday
  19128. ============
  19129.  
  19130. Syntax
  19131. ------
  19132.  
  19133.      #include <time.h>
  19134.      
  19135.      int settimeofday(struct timeval *tp, ...);
  19136.  
  19137. Description
  19138. -----------
  19139.  
  19140. Sets the current GMT time.  For compatibility, a second argument is
  19141. accepted.  *Note gettimeofday:: for information on the structure types.
  19142.  
  19143. Return Value
  19144. ------------
  19145.  
  19146. Zero if the time was set, nonzero on error.
  19147.  
  19148. 
  19149. File: libc,  Node: setvbuf,  Next: siglongjmp,  Prev: settimeofday,  Up: Alphabetical List
  19150.  
  19151. setvbuf
  19152. =======
  19153.  
  19154. Syntax
  19155. ------
  19156.  
  19157.      #include <stdio.h>
  19158.      
  19159.      int setvbuf(FILE *file, char *buffer, int type, int length);
  19160.  
  19161. Description
  19162. -----------
  19163.  
  19164. This function modifies the buffering characteristics of FILE.  First,
  19165. if the file already has a buffer, it is freed.  If there was any
  19166. pending data in it, it is lost, so this function should only be used
  19167. immediately after a call to `fopen'.
  19168.  
  19169. If the TYPE is `_IONBF', the BUFFER and LENGTH are ignored and the file
  19170. is set to unbuffered mode.
  19171.  
  19172. If the TYPE is `_IOLBF' or `_IOFBF', then the file is set to line or
  19173. fully buffered, respectively.  If BUFFER is `NULL', a buffer of size
  19174. SIZE is created and used as the buffer.  If BUFFER is non-`NULL', it
  19175. must point to a buffer of at least size SIZE and will be used as the
  19176. buffer.
  19177.  
  19178. *Note setbuf::.  *Note setbuffer::.  *Note setlinebuf::.
  19179.  
  19180. Return Value
  19181. ------------
  19182.  
  19183. Zero on success, nonzero on failure.
  19184.  
  19185. Example
  19186. -------
  19187.  
  19188.      setbuf(stderr, NULL, _IOLBF, 1000);
  19189.  
  19190. 
  19191. File: libc,  Node: siglongjmp,  Next: signal,  Prev: setvbuf,  Up: Alphabetical List
  19192.  
  19193. siglongjmp
  19194. ==========
  19195.  
  19196. Syntax
  19197. ------
  19198.  
  19199.      #include <setjmp.h>
  19200.      
  19201.      int    siglongjmp(sigjmp_buf env, int val);
  19202.  
  19203. Description
  19204. -----------
  19205.  
  19206. *Note longjmp::.
  19207.  
  19208. 
  19209. File: libc,  Node: signal,  Next: sigsetjmp,  Prev: siglongjmp,  Up: Alphabetical List
  19210.  
  19211. signal
  19212. ======
  19213.  
  19214. Syntax
  19215. ------
  19216.  
  19217.      #include <signal.h>
  19218.      
  19219.      void    (*signal(int _sig, void (*_func)(int)))(int);
  19220.  
  19221. Description
  19222. -----------
  19223.  
  19224. This function registers signal handlers.  Signal numbers are 0..255 for
  19225. software interrupts, 256..287 for exceptions (exception number plus
  19226. 256) or as specified in `<signal.h>'.
  19227.  
  19228. You may pass SIG_DFL to reset the default handling, SIG_ERR to force an
  19229. error when that signal happens, or SIG_IGN to ignore that signal.
  19230. Signal handlers are regular C functions, and may call any function that
  19231. the ANSI/POSIX specs say are valid for signal handlers.  Signal
  19232. handlers for hardware interrupts need special handling.
  19233.  
  19234. Return Value
  19235. ------------
  19236.  
  19237. The previous handler.
  19238.  
  19239. 
  19240. File: libc,  Node: sigsetjmp,  Next: sin,  Prev: signal,  Up: Alphabetical List
  19241.  
  19242. sigsetjmp
  19243. =========
  19244.  
  19245. Syntax
  19246. ------
  19247.  
  19248.      #include <setjmp.h>
  19249.      
  19250.      int    sigsetjmp(sigjmp_buf env, int savemask);
  19251.  
  19252. Description
  19253. -----------
  19254.  
  19255. *Note setjmp::.
  19256.  
  19257. 
  19258. File: libc,  Node: sin,  Next: sinh,  Prev: sigsetjmp,  Up: Alphabetical List
  19259.  
  19260. sin
  19261. ===
  19262.  
  19263. Syntax
  19264. ------
  19265.  
  19266.      #include <math.h>
  19267.      
  19268.      double sin(double x);
  19269.  
  19270. Return Value
  19271. ------------
  19272.  
  19273. The sine of X.
  19274.  
  19275. 
  19276. File: libc,  Node: sinh,  Next: sleep,  Prev: sin,  Up: Alphabetical List
  19277.  
  19278. sinh
  19279. ====
  19280.  
  19281. Syntax
  19282. ------
  19283.  
  19284.      #include <math.h>
  19285.      
  19286.      double sinh(double x);
  19287.  
  19288. Return Value
  19289. ------------
  19290.  
  19291. The hyperbolic sine of X.
  19292.  
  19293. 
  19294. File: libc,  Node: sleep,  Next: sound,  Prev: sinh,  Up: Alphabetical List
  19295.  
  19296. sleep
  19297. =====
  19298.  
  19299. Syntax
  19300. ------
  19301.  
  19302.      #include <unistd.h>
  19303.      
  19304.      unsigned sleep(unsigned seconds);
  19305.  
  19306. Description
  19307. -----------
  19308.  
  19309. This function causes the program to pause for SECONDS seconds.
  19310.  
  19311. Return Value
  19312. ------------
  19313.  
  19314. The number of seconds that haven't passed (i.e. always zero)
  19315.  
  19316. Example
  19317. -------
  19318.  
  19319.      sleep(5);
  19320.  
  19321. 
  19322. File: libc,  Node: sound,  Next: spawn*,  Prev: sleep,  Up: Alphabetical List
  19323.  
  19324. sound
  19325. =====
  19326.  
  19327. Syntax
  19328. ------
  19329.  
  19330.      #include <pc.h>
  19331.      
  19332.      void        sound(int _frequency);
  19333.  
  19334. Description
  19335. -----------
  19336.  
  19337. Enables the PC speaker at the given frequency.
  19338.  
  19339. 
  19340. File: libc,  Node: spawn*,  Next: sprintf,  Prev: sound,  Up: Alphabetical List
  19341.  
  19342. spawn*
  19343. ======
  19344.  
  19345. Syntax
  19346. ------
  19347.  
  19348.      #include <process.h>
  19349.      
  19350.      int spawnl(int mode, const char *path, const char *argv0, ...);
  19351.      int spawnle(int mode, const char *path, const char *argv0, ... /*, const char **envp */);
  19352.      int spawnlp(int mode, const char *path, const char *argv0, ...);
  19353.      int spawnlpe(int mode, const char *path, const char *argv0, ... /*, const char **envp */);
  19354.      
  19355.      int spawnv(int mode, const char *path, const char **argv);
  19356.      int spawnve(int mode, const char *path, const char **argv, const char **envp);
  19357.      int spawnvp(int mode, const char *path, const char **argv);
  19358.      int spawnvpe(int mode, const char *path, const char **argv, const char **envp);
  19359.  
  19360. Description
  19361. -----------
  19362.  
  19363. These functions run other programs.  The PATH points to the program to
  19364. run.  The extension is optional - if not given, the usual extensions
  19365. `.com', `.exe', and `.bat' are checked.
  19366.  
  19367. The programs are invoked with the arguments given.  The zeroth argument
  19368. is normally not used, since MS-DOS cannot pass it separately.  There are
  19369. two ways of passing arguments.  The `l' functions (like `spawnl') take
  19370. a list of arguments, with a zero at the end of the list.  This is
  19371. useful when you know how many argument there will be ahead of time.
  19372. The `v' functions (like `spawnv') take a pointer to a list of
  19373. arguments.  This is useful when you need to compute the number of
  19374. arguments at runtime.
  19375.  
  19376. In either case, you may also specify `e' to indicate that you will be
  19377. giving an explicit environment, else the current environment is used.
  19378. You may also specify `p' to indicate that you would like `spawn*' to
  19379. search the PATH (in either the environment you pass or the current
  19380. environment) for the executable, else it will only check the explicit
  19381. path given.
  19382.  
  19383. Note that these function understand about other djgpp programs, and will
  19384. call them directly, so that you can pass command lines longer than 128
  19385. characters to them without any special code.
  19386.  
  19387. *Note exec*::.
  19388.  
  19389. Return Value
  19390. ------------
  19391.  
  19392. If successful and `mode' is `P_WAIT', these functions return the exit
  19393. code of the child process.  Note that if the program is run by a
  19394. command processor (e.g., if it's a batch file), the exit code of that
  19395. command processor will be returned.  `COMMAND.COM' is notorious for
  19396. returning 0 even if it couldn't run the command.
  19397.  
  19398. If successful and MODE is `P_OVERLAY', these functions will not return.
  19399.  
  19400. If there is an error, these functions return -1 and set `errno' to
  19401. indicate the error.
  19402.  
  19403. Example
  19404. -------
  19405.  
  19406.  
  19407.      char *environ[] = {
  19408.        "PATH=c:\\dos;c:\\djgpp;c:\\usr\\local\\bin",
  19409.        "DJGPP=c:/djgpp",
  19410.        0
  19411.      };
  19412.      
  19413.      char *args[] = {
  19414.        "gcc",
  19415.        "-v",
  19416.        "hello.c",
  19417.        0
  19418.      };
  19419.      
  19420.      spawnvpe("gcc", args, environ);
  19421.  
  19422. 
  19423. File: libc,  Node: sprintf,  Next: sqrt,  Prev: spawn*,  Up: Alphabetical List
  19424.  
  19425. sprintf
  19426. =======
  19427.  
  19428. Syntax
  19429. ------
  19430.  
  19431.      #include <stdio.h>
  19432.      
  19433.      int sprintf(char *buffer, const char *format, ...);
  19434.  
  19435. Description
  19436. -----------
  19437.  
  19438. Sends formatted output from the arguments (...) to the BUFFER.  *Note
  19439. printf::.
  19440.  
  19441. Return Value
  19442. ------------
  19443.  
  19444. The number of characters written.
  19445.  
  19446. 
  19447. File: libc,  Node: sqrt,  Next: srandom,  Prev: sprintf,  Up: Alphabetical List
  19448.  
  19449. sqrt
  19450. ====
  19451.  
  19452. Syntax
  19453. ------
  19454.  
  19455.      #include <math.h>
  19456.      
  19457.      double sqrt(double x);
  19458.  
  19459. Return Value
  19460. ------------
  19461.  
  19462. The square root of X.
  19463.  
  19464. 
  19465. File: libc,  Node: srandom,  Next: sscanf,  Prev: sqrt,  Up: Alphabetical List
  19466.  
  19467. srandom
  19468. =======
  19469.  
  19470. Syntax
  19471. ------
  19472.  
  19473.      #include <stdlib.h>
  19474.      
  19475.      int srandom(int seed);
  19476.  
  19477. Description
  19478. -----------
  19479.  
  19480. This function initialized the random number generator (*note random::.).
  19481. Passing the same SEED results in `random' returning predictable
  19482. sequences of numbers.
  19483.  
  19484. Return Value
  19485. ------------
  19486.  
  19487. Zero.
  19488.  
  19489. Example
  19490. -------
  19491.  
  19492.      srandom(45);
  19493.  
  19494. 
  19495. File: libc,  Node: sscanf,  Next: stat,  Prev: srandom,  Up: Alphabetical List
  19496.  
  19497. sscanf
  19498. ======
  19499.  
  19500. Syntax
  19501. ------
  19502.  
  19503.      #include <stdio.h>
  19504.      
  19505.      int sscanf(const char *string, const char *format, ...);
  19506.  
  19507. Description
  19508. -----------
  19509.  
  19510. This function scans formatted text from the STRING and stores it in the
  19511. variables pointed to by the arguments.  *Note scanf::.
  19512.  
  19513. Return Value
  19514. ------------
  19515.  
  19516. The number of items successfully scanned.
  19517.  
  19518. 
  19519. File: libc,  Node: stat,  Next: statfs,  Prev: sscanf,  Up: Alphabetical List
  19520.  
  19521. stat
  19522. ====
  19523.  
  19524. Syntax
  19525. ------
  19526.  
  19527.      #include <sys/stat.h>
  19528.      
  19529.      int stat(const char *file, struct stat *sbuf);
  19530.  
  19531. Description
  19532. -----------
  19533.  
  19534. This function obtains the status of the file FILE and stores it in
  19535. SBUF, which has this structure:
  19536.  
  19537.      struct  stat {
  19538.              time_t   st_atime;     /* time of last modification */
  19539.              time_t   st_ctime;     /*            ''             */
  19540.              dev_t    st_dev;       /* The drive number (0 = a:) */
  19541.              gid_t    st_gid;       /* getgid() */
  19542.              ino_t    st_ino;       /* starting cluster or a unique identifier */
  19543.              mode_t   st_mode;      /* file mode - S_IF* and S_IRUSR/S_IWUSR */
  19544.              time_t   st_mtime;     /*            ''             */
  19545.              nlink_t  st_nlink;     /* 1 */
  19546.              off_t    st_size;      /* size of file in bytes */
  19547.              off_t    st_blksize;   /* the size of transfer buffer */
  19548.              uid_t    st_uid;       /* getuid() */
  19549.      };
  19550.  
  19551. Return Value
  19552. ------------
  19553.  
  19554. Zero on success, nonzero on failure (and ERRNO set).
  19555.  
  19556. Example
  19557. -------
  19558.  
  19559.      struct stat s;
  19560.      stat("data.txt", &s);
  19561.      if (S_ISDIR(s.st_mode))
  19562.        printf("is directory\n");
  19563.  
  19564. Implementation Notes
  19565. --------------------
  19566.  
  19567. Supplying a 100% Unix-compatible `f?stat()' functions under DOS is an
  19568. implementation nightmare.  The following notes describe some of the
  19569. obscure points specific to their behavior in DJGPP.
  19570.  
  19571. 1. The `drive' for character devices (like `con', `/dev/nul' and others
  19572. is returned as -1.  For drives networked by Novell Netware, it is
  19573. returned as -2.
  19574.  
  19575. 2. The starting cluster number of a file serves as its inode number.
  19576. For files whose starting cluster number is inaccessible (empty files,
  19577. files on networked drives, etc.) the `st_inode' field will be `invented'
  19578. in a way which guarantees that no two different files will get the same
  19579. inode number (thus it is unique).  This invented inode will also be
  19580. different from any real cluster number of any local file.  However, only
  19581. for local, non-empty files/directories the inode is guaranteed to be
  19582. consistent between `stat()' and `fstat()' function calls.
  19583.  
  19584. 3. The WRITE access mode bit is set only for the user (unless the file
  19585. is read-only, hidden or system).  EXECUTE bit is set for directories,
  19586. files which can be executed from the DOS prompt (batch files, .com,
  19587. .dll and .exe executables) or run by go32 extender.
  19588.  
  19589. 4. Size of directories is reported as the number of its files (sans `.'
  19590. and `..' entries) multiplied by 32 bytes (the size of directory entry).
  19591.  
  19592. 5. Time stamp for root directories is taken from the volume label entry,
  19593. if that's available; otherwise, it is reported as 1-Jan-1980.
  19594.  
  19595. 6. The variable *Note _djstat_flags:: controls what hard-to-get fields
  19596. of `struct stat' are needed by the application.
  19597.  
  19598. 7. `stat()' should not be used to get an up-to-date info about a file
  19599. which is open and has been written to, because `stat()' will only
  19600. return correct data after the file is closed.  Use *Note fstat:: while
  19601. the file is open.
  19602.  
  19603. 
  19604. File: libc,  Node: statfs,  Next: _status87,  Prev: stat,  Up: Alphabetical List
  19605.  
  19606. statfs
  19607. ======
  19608.  
  19609. Syntax
  19610. ------
  19611.  
  19612.      #include <sys/vfs.h>
  19613.      
  19614.      int statfs(const char *filename, struct statfs *buf);
  19615.  
  19616. Description
  19617. -----------
  19618.  
  19619. This function returns information about the given "filesystem".  The
  19620. drive letter of the given FILENAME, or the default drive if none is
  19621. given, is used to retrieve the following structure:
  19622.  
  19623.      struct statfs
  19624.      {
  19625.          long    f_type;   /* 0 */
  19626.          long    f_bsize;  /* bytes per cluster */
  19627.          long    f_blocks; /* clusters on drive */
  19628.          long    f_bfree;  /* available clusters */
  19629.          long    f_bavail; /* available clusters */
  19630.          long    f_files;  /* clusters on drive */
  19631.          long    f_ffree;  /* available clusters */
  19632.          fsid_t    f_fsid;   /* [0]=drive_number, [1]=MOUNT_UFS
  19633.          long    f_magic;  /* FS_MAGIC */
  19634.      };
  19635.  
  19636. Return Value
  19637. ------------
  19638.  
  19639. Zero on success, nonzero on failure.
  19640.  
  19641. Example
  19642. -------
  19643.  
  19644.      struct statfs fs;
  19645.      statfs("anything", &fs);
  19646.      printf("%d bytes left\n", fs.f_bfree * fs.f_bsize);
  19647.  
  19648. 
  19649. File: libc,  Node: _status87,  Next: _stklen,  Prev: statfs,  Up: Alphabetical List
  19650.  
  19651. _status87
  19652. =========
  19653.  
  19654. Syntax
  19655. ------
  19656.  
  19657.      #include <float.h>
  19658.      
  19659.      unsigned int _status87(void);
  19660.  
  19661. Description
  19662. -----------
  19663.  
  19664. Returns the status word of the FPU, which indicate the results of the
  19665. most recently completed FPU operation:
  19666.  
  19667.      ---- ---- ---- ---X = SW_INVALID - invalid operation
  19668.      ---- ---- ---- --X- = SW_DENORMAL - denormalized operand
  19669.      ---- ---- ---- -X-- = SW_ZERODIVIDE - division by zero
  19670.      ---- ---- ---- X--- = SW_OVERFLOW - overflow
  19671.      ---- ---- ---X ---- = SW_UNDERFLOW - underflow
  19672.      ---- ---- --X- ---- = SW_INEXACT - loss of precision
  19673.      ---- ---- -X-- ---- = SW_STACKFAULT - stack over/under flow
  19674.      ---- ---- X--- ---- = SW_ERRORSUMMARY - set if any errors
  19675.      -X-- -XXX ---- ---- = SW_COND - condition code
  19676.      ---- ---X ---- ---- = SW_C0
  19677.      ---- --X- ---- ---- = SW_C1
  19678.      ---- -X-- ---- ---- = SW_C2
  19679.      -X-- ---- ---- ---- = SW_C3
  19680.      --XX X--- ---- ---- = SW_TOP - top of stack (use SW_TOP_SHIFT to shift it)
  19681.      X--- ---- ---- ---- = SW_BUSY - fpu is busy
  19682.  
  19683. 
  19684. File: libc,  Node: _stklen,  Next: stpcpy,  Prev: _status87,  Up: Alphabetical List
  19685.  
  19686. _stklen
  19687. =======
  19688.  
  19689. Syntax
  19690. ------
  19691.  
  19692.      extern int _stklen;
  19693.  
  19694. Description
  19695. -----------
  19696.  
  19697. This variable sets the minimum stack length that the program requires.
  19698. Note that the stack may be much larger than this.  This value should be
  19699. set statically, as it is only used at startup.
  19700.  
  19701. Example
  19702. -------
  19703.  
  19704.      extern int _stklen = 256000;
  19705.  
  19706. 
  19707. File: libc,  Node: stpcpy,  Next: strcase,  Prev: _stklen,  Up: Alphabetical List
  19708.  
  19709. stpcpy
  19710. ======
  19711.  
  19712. Syntax
  19713. ------
  19714.  
  19715.      #include <string.h>
  19716.      
  19717.      char *stpcpy(char *_dest, const char *_src);
  19718.  
  19719. Description
  19720. -----------
  19721.  
  19722. Like `strcpy' (*note strcpy::.), but return value different.
  19723.  
  19724. Return Value
  19725. ------------
  19726.  
  19727. Returns a pointer to the trailing NUL in DEST.
  19728.  
  19729. 
  19730. File: libc,  Node: strcase,  Next: strcasecmp,  Prev: stpcpy,  Up: Alphabetical List
  19731.  
  19732. strcase
  19733. =======
  19734.  
  19735. Syntax
  19736. ------
  19737.  
  19738.      #include <string.h>
  19739.      
  19740.      int strcase(const char *s1, const char *s2);
  19741.  
  19742. Description
  19743. -----------
  19744.  
  19745. This function compares the two strings, disregarding case.
  19746.  
  19747. Return Value
  19748. ------------
  19749.  
  19750. Zero if they're the same, nonzero if different, the sign indicates
  19751. "order".
  19752.  
  19753. Example
  19754. -------
  19755.  
  19756.      if (strcase(arg, "-i") == 0)
  19757.        do_include();
  19758.  
  19759. 
  19760. File: libc,  Node: strcasecmp,  Next: strcat,  Prev: strcase,  Up: Alphabetical List
  19761.  
  19762. strcasecmp
  19763. ==========
  19764.  
  19765. Syntax
  19766. ------
  19767.  
  19768.      #include <string.h>
  19769.      
  19770.      int strcasecmp(const char *s1, const char *s2);
  19771.  
  19772. Description
  19773. -----------
  19774.  
  19775. This function compares the two strings, disregarding case.
  19776.  
  19777. Return Value
  19778. ------------
  19779.  
  19780. Zero if they're the same, nonzero if different, the sign indicates
  19781. "order".
  19782.  
  19783. Example
  19784. -------
  19785.  
  19786.      if (strcasecmp(arg, "-i") == 0)
  19787.        do_include();
  19788.  
  19789. 
  19790. File: libc,  Node: strcat,  Next: strchr,  Prev: strcasecmp,  Up: Alphabetical List
  19791.  
  19792. strcat
  19793. ======
  19794.  
  19795. Syntax
  19796. ------
  19797.  
  19798.      #include <string.h>
  19799.      
  19800.      char *strcat(char *s1, const char *s2);
  19801.  
  19802. Description
  19803. -----------
  19804.  
  19805. This function concatenates S2 to the end of S1.
  19806.  
  19807. Return Value
  19808. ------------
  19809.  
  19810. S1
  19811.  
  19812. Example
  19813. -------
  19814.  
  19815.      char buf[100] = "hello";
  19816.      strcat(buf, " there");
  19817.  
  19818. 
  19819. File: libc,  Node: strchr,  Next: strcmp,  Prev: strcat,  Up: Alphabetical List
  19820.  
  19821. strchr
  19822. ======
  19823.  
  19824. Syntax
  19825. ------
  19826.  
  19827.      #include <string.h>
  19828.      
  19829.      char *strchr(const char *s, int c);
  19830.  
  19831. Description
  19832. -----------
  19833.  
  19834. This function returns a pointer to the first occurrence of C in S.
  19835. Note that if C is `NULL', this will return a pointer to the end of the
  19836. string.
  19837.  
  19838. Return Value
  19839. ------------
  19840.  
  19841. A pointer to the character, or `NULL' if it wasn't found.
  19842.  
  19843. Example
  19844. -------
  19845.  
  19846.      char *slash = strchr(filename, '/');
  19847.  
  19848. 
  19849. File: libc,  Node: strcmp,  Next: strcoll,  Prev: strchr,  Up: Alphabetical List
  19850.  
  19851. strcmp
  19852. ======
  19853.  
  19854. Syntax
  19855. ------
  19856.  
  19857.      #include <string.h>
  19858.      
  19859.      int strcmp(const char *s1, const char *s2);
  19860.  
  19861. Description
  19862. -----------
  19863.  
  19864. This function compares S1 and S2.
  19865.  
  19866. Return Value
  19867. ------------
  19868.  
  19869. Zero if the strings are equal, a positive number if S1 comes after S2
  19870. in the ASCII collating sequense, else a negative number.
  19871.  
  19872. Example
  19873. -------
  19874.  
  19875.      if (strcmp(arg, "-i") == 0)
  19876.        do_include();
  19877.  
  19878. 
  19879. File: libc,  Node: strcoll,  Next: strcpy,  Prev: strcmp,  Up: Alphabetical List
  19880.  
  19881. strcoll
  19882. =======
  19883.  
  19884. Syntax
  19885. ------
  19886.  
  19887.      #include <string.h>
  19888.      
  19889.      int strcoll(const char *s1, const char *s2);
  19890.  
  19891. Description
  19892. -----------
  19893.  
  19894. This function compares S1 and S2, using the collating sequences from
  19895. the current locale.
  19896.  
  19897. Return Value
  19898. ------------
  19899.  
  19900. Zero if the strings are equal, a positive number if S1 comes after S2
  19901. in the collating sequense, else a negative number.
  19902.  
  19903. Example
  19904. -------
  19905.  
  19906.      while (strcoll(var, list[i]) < 0)
  19907.        i++;
  19908.  
  19909. 
  19910. File: libc,  Node: strcpy,  Next: strcspn,  Prev: strcoll,  Up: Alphabetical List
  19911.  
  19912. strcpy
  19913. ======
  19914.  
  19915. Syntax
  19916. ------
  19917.  
  19918.      #include <string.h>
  19919.      
  19920.      char *strcpy(char *s1, const char *s2);
  19921.  
  19922. Description
  19923. -----------
  19924.  
  19925. This function copies S2 into S1.
  19926.  
  19927. Return Value
  19928. ------------
  19929.  
  19930. S1
  19931.  
  19932. Example
  19933. -------
  19934.  
  19935.      char buf[100];
  19936.      strcpy(buf, arg);
  19937.  
  19938. 
  19939. File: libc,  Node: strcspn,  Next: strdup,  Prev: strcpy,  Up: Alphabetical List
  19940.  
  19941. strcspn
  19942. =======
  19943.  
  19944. Syntax
  19945. ------
  19946.  
  19947.      #include <string.h>
  19948.      
  19949.      size_t strcspn(const char *s1, const char *set);
  19950.  
  19951. Description
  19952. -----------
  19953.  
  19954. This function finds the first character in S1 that matches any
  19955. character in SET.  Note that the `NULL' bytes at the end of each string
  19956. counts, so you'll at least get a pointer to the end of the string if
  19957. nothing else.
  19958.  
  19959. Return Value
  19960. ------------
  19961.  
  19962. The index of the found character.
  19963.  
  19964. Example
  19965. -------
  19966.  
  19967.      int i = strcspn(command, "<>|");
  19968.      if (command[i])
  19969.        do_redirection();
  19970.  
  19971. 
  19972. File: libc,  Node: strdup,  Next: strerror,  Prev: strcspn,  Up: Alphabetical List
  19973.  
  19974. strdup
  19975. ======
  19976.  
  19977. Syntax
  19978. ------
  19979.  
  19980.      #include <string.h>
  19981.      
  19982.      char * strdup (const char *source);
  19983.  
  19984. Description
  19985. -----------
  19986.  
  19987. Returns a newly allocated area of memory that contains a duplicate of
  19988. the string pointed to by SOURCE.  The memory returned by this call must
  19989. be freed by the caller.
  19990.  
  19991. Return Value
  19992. ------------
  19993.  
  19994. Returns the newly allocated string, or NULL if there is no more memory.
  19995.  
  19996. Example
  19997. -------
  19998.  
  19999.      char *foo()
  20000.      {
  20001.        return strdup("hello");
  20002.      }
  20003.  
  20004. 
  20005. File: libc,  Node: strerror,  Next: strftime,  Prev: strdup,  Up: Alphabetical List
  20006.  
  20007. strerror
  20008. ========
  20009.  
  20010. Syntax
  20011. ------
  20012.  
  20013.      #include <string.h>
  20014.      
  20015.      char *strerror(int error);
  20016.  
  20017. Description
  20018. -----------
  20019.  
  20020. This function returns a string that describes the ERROR.
  20021.  
  20022. Return Value
  20023. ------------
  20024.  
  20025. A pointer to a static string that should not be modified or free'd.
  20026.  
  20027. Example
  20028. -------
  20029.  
  20030.      if (f=fopen("foo", "r") == 0)
  20031.        printf("Error! %s: %s\n", "foo", strerror(errno));
  20032.  
  20033. 
  20034. File: libc,  Node: strftime,  Next: stricmp,  Prev: strerror,  Up: Alphabetical List
  20035.  
  20036. strftime
  20037. ========
  20038.  
  20039. Syntax
  20040. ------
  20041.  
  20042.      #include <time.h>
  20043.      
  20044.      size_t strftime(char *buf, size_t n, const char *format, const struct tm *time);
  20045.  
  20046. Description
  20047. -----------
  20048.  
  20049. This function formats the given TIME according to the given FORMAT and
  20050. stores it in BUF, not exceeding N bytes.
  20051.  
  20052. The format string is like `printf' in that any character other than `%'
  20053. is added to the output string, and for each character following a `%' a
  20054. pattern is added to the string as follows, with the examples as if the
  20055. time was Friday, October 1, 1993, at 03:30:34 PM EDT:
  20056.  
  20057. `%A'
  20058.      The full weekday name (`Friday')
  20059.  
  20060. `%a'
  20061.      The abbreviated weekday name (`Fri')
  20062.  
  20063. `%B'
  20064.      The full month name (`October')
  20065.  
  20066. `%b'
  20067. `%h'
  20068.      The abbreviated month name (`Oct')
  20069.  
  20070. `%C'
  20071.      Short for `%a %b %e %H:%M:%S %Y' (`Fri Oct  1 15:30:34 1993')
  20072.  
  20073. `%c'
  20074.      Short for `%m/%d/%y %H:%M:%S' (`10/01/93 15:30:34')
  20075.  
  20076. `%e'
  20077.      The day of the month, blank padded to two characters (` 2')
  20078.  
  20079. `%D'
  20080.      Short for `%m/%d/%y' (`10/01/93')
  20081.  
  20082. `%d'
  20083.      The day of the month, zero padded to two characters (`02')
  20084.  
  20085. `%H'
  20086.      The hour (0-24), zero padded to two characters (`15')
  20087.  
  20088. `%I'
  20089.      The hour (1-12), zero padded to two characters (`03')
  20090.  
  20091. `%j'
  20092.      The Julian day, zero padded to three characters (`275')
  20093.  
  20094. `%k'
  20095.      The hour (0-24), space padded to two characters (`15')
  20096.  
  20097. `%l'
  20098.      The hour (1-12), space padded to two characters(` 3')
  20099.  
  20100. `%M'
  20101.      The minutes, zero padded to two characters (`30')
  20102.  
  20103. `%m'
  20104.      The month (1-12), zero padded to two characters (`10')
  20105.  
  20106. `%n'
  20107.      A newline (`\n')
  20108.  
  20109. `%p'
  20110.      AM or PM (`PM')
  20111.  
  20112. `%R'
  20113.      Short for `%H:%M' (`15:30')
  20114.  
  20115. `%r'
  20116.      Short for `%I:%M:%S %p' (`03:30:35 PM')
  20117.  
  20118. `%S'
  20119.      The seconds, zero padded to two characters (`35')
  20120.  
  20121. `%T'
  20122. `%X'
  20123.      Short for `%H:%M:%S' (`15:30:35')
  20124.  
  20125. `%t'
  20126.      A tab (`\t')
  20127.  
  20128. `%U'
  20129.      The week of the year, with the first week defined by the first
  20130.      Sunday of the year, zero padded to two characters (`39')
  20131.  
  20132. `%W'
  20133.      The week of the year, with the first week defined by the first
  20134.      Monday of the year, zero padded to two characters (`39')
  20135.  
  20136. `%w'
  20137.      The day of the week (0-6) (`5')
  20138.  
  20139. `%x'
  20140.      Short for `%m/%d/%y' (`10/01/93')
  20141.  
  20142. `%y'
  20143.      The year (00-99) of the century (`93')
  20144.  
  20145. `%Y'
  20146.      The year, zero padded to four digits (`1993')
  20147.  
  20148. `%Z'
  20149.      The timezone abbreviation (`EDT')
  20150.  
  20151. `%%'
  20152.      A percent symbol (`%')
  20153.  
  20154. Return Value
  20155. ------------
  20156.  
  20157. The number of characters stored.
  20158.  
  20159. Example
  20160. -------
  20161.  
  20162.      struct tm t;
  20163.      char buf[100];
  20164.      strftime(buf, 100, "%B %d, %Y", &t);
  20165.  
  20166. 
  20167. File: libc,  Node: stricmp,  Next: strlen,  Prev: strftime,  Up: Alphabetical List
  20168.  
  20169. stricmp
  20170. =======
  20171.  
  20172. Syntax
  20173. ------
  20174.  
  20175.      #include <string.h>
  20176.      
  20177.      int stricmp(const char *s1, const char *s2);
  20178.  
  20179. Description
  20180. -----------
  20181.  
  20182. This function compares the two strings, disregarding case.
  20183.  
  20184. Return Value
  20185. ------------
  20186.  
  20187. Zero if they're the same, nonzero if different, the sign indicates
  20188. "order".
  20189.  
  20190. Example
  20191. -------
  20192.  
  20193.      if (stricmp(arg, "-i") == 0)
  20194.        do_include();
  20195.  
  20196. 
  20197. File: libc,  Node: strlen,  Next: strlwr,  Prev: stricmp,  Up: Alphabetical List
  20198.  
  20199. strlen
  20200. ======
  20201.  
  20202. Syntax
  20203. ------
  20204.  
  20205.      #include <string.h>
  20206.      
  20207.      size_t strlen(const char *string);
  20208.  
  20209. Description
  20210. -----------
  20211.  
  20212. This function returns the number of characters in STRING.
  20213.  
  20214. Return Value
  20215. ------------
  20216.  
  20217. The length of the string.
  20218.  
  20219. Example
  20220. -------
  20221.  
  20222.      if (strlen(fname) > PATH_MAX)
  20223.        invalid_file(fname);
  20224.  
  20225. 
  20226. File: libc,  Node: strlwr,  Next: strncase,  Prev: strlen,  Up: Alphabetical List
  20227.  
  20228. strlwr
  20229. ======
  20230.  
  20231. Syntax
  20232. ------
  20233.  
  20234.      #include <string.h>
  20235.      
  20236.      char *strlwr(char *string);
  20237.  
  20238. Description
  20239. -----------
  20240.  
  20241. This function replaces all upper case letters in STRING with lower case
  20242. letters.
  20243.  
  20244. Return Value
  20245. ------------
  20246.  
  20247. The string.
  20248.  
  20249. Example
  20250. -------
  20251.  
  20252.      char buf[100] = "Hello";
  20253.      strlwr(buf);
  20254.  
  20255. 
  20256. File: libc,  Node: strncase,  Next: strncasecmp,  Prev: strlwr,  Up: Alphabetical List
  20257.  
  20258. strncase
  20259. ========
  20260.  
  20261. Syntax
  20262. ------
  20263.  
  20264.      #include <string.h>
  20265.      
  20266.      int strncase(const char *s1, const char *s2, size_t max);
  20267.  
  20268. Description
  20269. -----------
  20270.  
  20271. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  20272. characters.
  20273.  
  20274. Return Value
  20275. ------------
  20276.  
  20277. Zero if the strings are equal, a positive number if S1 comes after S2
  20278. in the ASCII collating sequense, else a negative number.
  20279.  
  20280. Example
  20281. -------
  20282.  
  20283.      if (strncase(foo, "-i", 2) == 0)
  20284.        do_include();
  20285.  
  20286. 
  20287. File: libc,  Node: strncasecmp,  Next: strncat,  Prev: strncase,  Up: Alphabetical List
  20288.  
  20289. strncasecmp
  20290. ===========
  20291.  
  20292. Syntax
  20293. ------
  20294.  
  20295.      #include <string.h>
  20296.      
  20297.      int strncasecmp(const char *s1, const char *s2, size_t max);
  20298.  
  20299. Description
  20300. -----------
  20301.  
  20302. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  20303. characters.
  20304.  
  20305. Return Value
  20306. ------------
  20307.  
  20308. Zero if the strings are equal, a positive number if S1 comes after S2
  20309. in the ASCII collating sequense, else a negative number.
  20310.  
  20311. Example
  20312. -------
  20313.  
  20314.      if (strncasecmp(foo, "-i", 2) == 0)
  20315.        do_include();
  20316.  
  20317. 
  20318. File: libc,  Node: strncat,  Next: strncmp,  Prev: strncasecmp,  Up: Alphabetical List
  20319.  
  20320. strncat
  20321. =======
  20322.  
  20323. Syntax
  20324. ------
  20325.  
  20326.      #include <string.h>
  20327.      
  20328.      char *strncat(char *s1, const char *s2, size_t max);
  20329.  
  20330. Description
  20331. -----------
  20332.  
  20333. This function concatenates up to MAX characters of S2 to the end of S1.
  20334.  
  20335. Return Value
  20336. ------------
  20337.  
  20338. S1
  20339.  
  20340. Example
  20341. -------
  20342.  
  20343.      strncat(fname, extension, 4);
  20344.  
  20345. 
  20346. File: libc,  Node: strncmp,  Next: strncpy,  Prev: strncat,  Up: Alphabetical List
  20347.  
  20348. strncmp
  20349. =======
  20350.  
  20351. Syntax
  20352. ------
  20353.  
  20354.      #include <string.h>
  20355.      
  20356.      int strncmp(const char *s1, const char *s2, size_t max);
  20357.  
  20358. Description
  20359. -----------
  20360.  
  20361. This function compares upto MAX characters of S1 and S2.
  20362.  
  20363. Return Value
  20364. ------------
  20365.  
  20366. Zero if the strings are equal, a positive number if S1 comes after S2
  20367. in the ASCII collating sequense, else a negative number.
  20368.  
  20369. Example
  20370. -------
  20371.  
  20372.      if (strncmp(arg, "-i", 2) == 0)
  20373.        do_include();
  20374.  
  20375. 
  20376. File: libc,  Node: strncpy,  Next: strnicmp,  Prev: strncmp,  Up: Alphabetical List
  20377.  
  20378. strncpy
  20379. =======
  20380.  
  20381. Syntax
  20382. ------
  20383.  
  20384.      #include <string.h>
  20385.      
  20386.      char *strncpy(char *s1, const char *s2, size_t max);
  20387.  
  20388. Description
  20389. -----------
  20390.  
  20391. This function copies up to MAX characters of S2 into S1.
  20392.  
  20393. Return Value
  20394. ------------
  20395.  
  20396. S1
  20397.  
  20398. Example
  20399. -------
  20400.  
  20401.      char buf[100];
  20402.      strcpy(buf, arg, 99);
  20403.  
  20404. 
  20405. File: libc,  Node: strnicmp,  Next: strpbrk,  Prev: strncpy,  Up: Alphabetical List
  20406.  
  20407. strnicmp
  20408. ========
  20409.  
  20410. Syntax
  20411. ------
  20412.  
  20413.      #include <string.h>
  20414.      
  20415.      int strnicmp(const char *s1, const char *s2, size_t max);
  20416.  
  20417. Description
  20418. -----------
  20419.  
  20420. This function compares S1 and S2, ignoring case, up to a maximum of MAX
  20421. characters.
  20422.  
  20423. Return Value
  20424. ------------
  20425.  
  20426. Zero if the strings are equal, a positive number if S1 comes after S2
  20427. in the ASCII collating sequense, else a negative number.
  20428.  
  20429. Example
  20430. -------
  20431.  
  20432.      if (strnicmp(foo, "-i", 2) == 0)
  20433.        do_include();
  20434.  
  20435. 
  20436. File: libc,  Node: strpbrk,  Next: strrchr,  Prev: strnicmp,  Up: Alphabetical List
  20437.  
  20438. strpbrk
  20439. =======
  20440.  
  20441. Syntax
  20442. ------
  20443.  
  20444.      #include <string.h>
  20445.      
  20446.      char *strpbrk(const char *s1, const char *set);
  20447.  
  20448. Description
  20449. -----------
  20450.  
  20451. This function finds the first character in S1 that matches any
  20452. character in SET.
  20453.  
  20454. Return Value
  20455. ------------
  20456.  
  20457. A pointer to the first match, or `NULL' if none are found.
  20458.  
  20459. Example
  20460. -------
  20461.  
  20462.      if (strpbrk(command, "<>|"))
  20463.        do_redirection();
  20464.  
  20465. 
  20466. File: libc,  Node: strrchr,  Next: strsep,  Prev: strpbrk,  Up: Alphabetical List
  20467.  
  20468. strrchr
  20469. =======
  20470.  
  20471. Syntax
  20472. ------
  20473.  
  20474.      #include <string.h>
  20475.      
  20476.      char *strrchr(const char *s1, int c);
  20477.  
  20478. Description
  20479. -----------
  20480.  
  20481. This function finds the last occurrence of `c' in `s1'.
  20482.  
  20483. Return Value
  20484. ------------
  20485.  
  20486. A pointer to the last match, or `NULL' if the character isn't in the
  20487. string.
  20488.  
  20489. Example
  20490. -------
  20491.  
  20492.      char *last_slash = strrchr(filename, '/');
  20493.  
  20494. 
  20495. File: libc,  Node: strsep,  Next: strspn,  Prev: strrchr,  Up: Alphabetical List
  20496.  
  20497. strsep
  20498. ======
  20499.  
  20500. Syntax
  20501. ------
  20502.  
  20503.      #include <string.h>
  20504.      
  20505.      char *strsep(char **stringp, char *delim);
  20506.  
  20507. Description
  20508. -----------
  20509.  
  20510. This function retrieves the next token from the given string, where
  20511. STRINGP points to a variable holding, initially, the start of the
  20512. string.  Tokens are delimited by a character from DELIM.  Each time the
  20513. function is called, it returns a pointer to the next token, and sets
  20514. *STRINGP to the next spot to check, or `NULL'.
  20515.  
  20516. Return Value
  20517. ------------
  20518.  
  20519. The next token, or NULL.
  20520.  
  20521. Example
  20522. -------
  20523.  
  20524.      main()
  20525.      {
  20526.        char *buf = "Hello  there,stranger";
  20527.        char **bp = &buf;
  20528.        char *tok;
  20529.        while (tok = strsep(bp, " ,"))
  20530.          printf("tok = `%s'\n", tok);
  20531.      }
  20532.      
  20533.      tok = `Hello'
  20534.      tok = `'
  20535.      tok = `there'
  20536.      tok = `stranger'
  20537.  
  20538. 
  20539. File: libc,  Node: strspn,  Next: strstr,  Prev: strsep,  Up: Alphabetical List
  20540.  
  20541. strspn
  20542. ======
  20543.  
  20544. Syntax
  20545. ------
  20546.  
  20547.      #include <string.h>
  20548.      
  20549.      size_t strspn(const char *s1, const char *set);
  20550.  
  20551. Description
  20552. -----------
  20553.  
  20554. This function finds the first character in S1 that does not match any
  20555. character in SET.  Note that the `NULL' bytes at the end of S1 counts,
  20556. so you'll at least get a pointer to the end of the string if nothing
  20557. else.
  20558.  
  20559. Return Value
  20560. ------------
  20561.  
  20562. The index of the found character.
  20563.  
  20564. Example
  20565. -------
  20566.  
  20567.      int i = strcspn(entry, " \t\b");
  20568.      if (entry[i])
  20569.        do_something();
  20570.  
  20571. 
  20572. File: libc,  Node: strstr,  Next: strtod,  Prev: strspn,  Up: Alphabetical List
  20573.  
  20574. strstr
  20575. ======
  20576.  
  20577. Syntax
  20578. ------
  20579.  
  20580.      #include <string.h>
  20581.      
  20582.      char *strstr(const char *s1, const char *s2);
  20583.  
  20584. Description
  20585. -----------
  20586.  
  20587. This function finds the first occurrence of S2 in S1.
  20588.  
  20589. Return Value
  20590. ------------
  20591.  
  20592. A pointer within S1, or `NULL' if S2 wasn't found.
  20593.  
  20594. Example
  20595. -------
  20596.  
  20597.      if (strstr(command, ".exe"))
  20598.        do_exe();
  20599.  
  20600. 
  20601. File: libc,  Node: strtod,  Next: strtok,  Prev: strstr,  Up: Alphabetical List
  20602.  
  20603. strtod
  20604. ======
  20605.  
  20606. Syntax
  20607. ------
  20608.  
  20609.      #include <stdlib.h>
  20610.      
  20611.      double strtod(const char *s, char **endp);
  20612.  
  20613. Description
  20614. -----------
  20615.  
  20616. This function converts as many characters of S that look like a
  20617. floating point number into one, and sets *ENDP to point to the first
  20618. unused character.
  20619.  
  20620. Return Value
  20621. ------------
  20622.  
  20623. The value the string represented.
  20624.  
  20625. Example
  20626. -------
  20627.  
  20628.      char *buf = "123ret";
  20629.      char *bp;
  20630.      double x = strtod(buf, &bp);
  20631.  
  20632. 
  20633. File: libc,  Node: strtok,  Next: strtol,  Prev: strtod,  Up: Alphabetical List
  20634.  
  20635. strtok
  20636. ======
  20637.  
  20638. Syntax
  20639. ------
  20640.  
  20641.      #include <string.h>
  20642.      
  20643.      char *strtok(char *s1, const char *s2);
  20644.  
  20645. Description
  20646. -----------
  20647.  
  20648. This function retrieves tokens from S1 which are delimited by
  20649. characters from S2.
  20650.  
  20651. To initiate the search, pass the string to be searched as S1.  For the
  20652. remaining tokens, pass `NULL' instead.
  20653.  
  20654. Return Value
  20655. ------------
  20656.  
  20657. A pointer to the token, or `NULL' if no more are found.
  20658.  
  20659. Example
  20660. -------
  20661.  
  20662.      main()
  20663.      {
  20664.        char *buf = "Hello there, stranger";
  20665.        char *tok;
  20666.        for (tok = strtok(buf, " ,");
  20667.             tok;
  20668.             tok=strtok(0, " ,"))
  20669.          printf("tok = `%s'\n", tok);
  20670.      }
  20671.      
  20672.      tok = `Hello'
  20673.      tok = `there'
  20674.      tok = `stranger'
  20675.  
  20676. 
  20677. File: libc,  Node: strtol,  Next: _strtold,  Prev: strtok,  Up: Alphabetical List
  20678.  
  20679. strtol
  20680. ======
  20681.  
  20682. Syntax
  20683. ------
  20684.  
  20685.      #include <stdlib.h>
  20686.      
  20687.      long strtol(const char *s, char **endp, int base);
  20688.  
  20689. Description
  20690. -----------
  20691.  
  20692. This function converts as much of S as looks like an appropriate number
  20693. into the value of that number, and sets *ENDP to point to the first
  20694. unused character.
  20695.  
  20696. The BASE argument indicates what base the digits (or letters) should be
  20697. treated as.  If BASE is zero, the base is determined by looking for
  20698. `0x', `0X', or `0' as the first part of the string, and sets the base
  20699. used to 16, 16, or 8 if it finds one.  The default base is 10 if none
  20700. of those prefixes are found.
  20701.  
  20702. Return Value
  20703. ------------
  20704.  
  20705. The value.
  20706.  
  20707. Example
  20708. -------
  20709.  
  20710.      printf("Enter a number: "); fflush(stdout);
  20711.      gets(buf);
  20712.      char *bp;
  20713.      printf("The value is %d\n", strtol(buf, &bp, 0));
  20714.  
  20715. 
  20716. File: libc,  Node: _strtold,  Next: strtoul,  Prev: strtol,  Up: Alphabetical List
  20717.  
  20718. _strtold
  20719. ========
  20720.  
  20721. Syntax
  20722. ------
  20723.  
  20724.      #include <stdlib.h>
  20725.      
  20726.      long double _strtold(const char *s, char **endp);
  20727.  
  20728. Description
  20729. -----------
  20730.  
  20731. This function converts as many characters of S that look like a
  20732. floating point number into one, and sets *ENDP to point to the first
  20733. unused character.
  20734.  
  20735. Return Value
  20736. ------------
  20737.  
  20738. The value the string represented.
  20739.  
  20740. Example
  20741. -------
  20742.  
  20743.      char *buf = "123ret";
  20744.      char *bp;
  20745.      long double x = _strtold(buf, &bp);
  20746.  
  20747. 
  20748. File: libc,  Node: strtoul,  Next: strupr,  Prev: _strtold,  Up: Alphabetical List
  20749.  
  20750. strtoul
  20751. =======
  20752.  
  20753. Syntax
  20754. ------
  20755.  
  20756.      #include <stdlib.h>
  20757.      
  20758.      unsigned long strtoul(const char *s, char **endp, int base);
  20759.  
  20760. Description
  20761. -----------
  20762.  
  20763. This is just like `strtol' (*note strtol::.) except that the result is
  20764. unsigned.
  20765.  
  20766. Return Value
  20767. ------------
  20768.  
  20769. The value.
  20770.  
  20771. Example
  20772. -------
  20773.  
  20774.      printf("Enter a number: "); fflush(stdout);
  20775.      gets(buf);
  20776.      char *bp;
  20777.      printf("The value is %u\n", strtoul(buf, &bp, 0));
  20778.  
  20779. 
  20780. File: libc,  Node: strupr,  Next: strxfrm,  Prev: strtoul,  Up: Alphabetical List
  20781.  
  20782. strupr
  20783. ======
  20784.  
  20785. Syntax
  20786. ------
  20787.  
  20788.      #include <string.h>
  20789.      
  20790.      char *strupr(char *string);
  20791.  
  20792. Description
  20793. -----------
  20794.  
  20795. This function converts all lower case characters in STRING to upper
  20796. case.
  20797.  
  20798. Return Value
  20799. ------------
  20800.  
  20801. STRING
  20802.  
  20803. Example
  20804. -------
  20805.  
  20806.      char buf[] = "Foo!";
  20807.      strupr(buf);
  20808.  
  20809. 
  20810. File: libc,  Node: strxfrm,  Next: swab,  Prev: strupr,  Up: Alphabetical List
  20811.  
  20812. strxfrm
  20813. =======
  20814.  
  20815. Syntax
  20816. ------
  20817.  
  20818.      #include <string.h>
  20819.      
  20820.      size_t strxfrm(char *s1, const char *s2, size_t max);
  20821.  
  20822. Description
  20823. -----------
  20824.  
  20825. This copies characters from S2 to S1, which must be able to hold MAX
  20826. characters.  Each character is transformed according to the locale such
  20827. that `strcmp(s1b, s2b)' is just like `strcoll(s1, s2)' where `s1b' and
  20828. `s2b' are the transforms of `s1' and `s2'.
  20829.  
  20830. Return Value
  20831. ------------
  20832.  
  20833. The actual number of bytes required to transform S2, including the
  20834. `NULL'.
  20835.  
  20836. 
  20837. File: libc,  Node: swab,  Next: sync,  Prev: strxfrm,  Up: Alphabetical List
  20838.  
  20839. swab
  20840. ====
  20841.  
  20842. Syntax
  20843. ------
  20844.  
  20845.      #include <stdlib.h>
  20846.      
  20847.      void swab(const void *from, void *to, int nbytes);
  20848.  
  20849. Description
  20850. -----------
  20851.  
  20852. This function copies NBYTES bytes from the address pointed to by FROM
  20853. to the address pointed by TO, exchanging adjacent even and odd bytes.
  20854. It is useful for carrying binary data between little-endian and
  20855. big-endian machines.  The argument NBYTES should be even, and the
  20856. buffers FROM and TO should not overlap.
  20857.  
  20858. Return Value
  20859. ------------
  20860.  
  20861. None.
  20862.  
  20863. 
  20864. File: libc,  Node: sync,  Next: sys_errlist,  Prev: swab,  Up: Alphabetical List
  20865.  
  20866. sync
  20867. ====
  20868.  
  20869. Description
  20870. -----------
  20871.  
  20872. This function is provided only to assist in porting from Unix.  It
  20873. always returns zero.
  20874.  
  20875. 
  20876. File: libc,  Node: sys_errlist,  Next: sys_nerr,  Prev: sync,  Up: Alphabetical List
  20877.  
  20878. sys_errlist
  20879. ===========
  20880.  
  20881. Syntax
  20882. ------
  20883.  
  20884.      #include <errno.h>
  20885.      
  20886.      extern char *sys_errlist[];
  20887.  
  20888. Description
  20889. -----------
  20890.  
  20891. This array contains error messages, indexed by `errno', that describe
  20892. the errors.
  20893.  
  20894. Example
  20895. -------
  20896.  
  20897.      printf("Error: %s\n", sys_errlist[errno]);
  20898.  
  20899. 
  20900. File: libc,  Node: sys_nerr,  Next: sysconf,  Prev: sys_errlist,  Up: Alphabetical List
  20901.  
  20902. sys_nerr
  20903. ========
  20904.  
  20905. Syntax
  20906. ------
  20907.  
  20908.      #include <errno.h>
  20909.      
  20910.      extern int sys_nerr;
  20911.  
  20912. Description
  20913. -----------
  20914.  
  20915. This variable gives the number of error messages in `sys_errlist'
  20916. (*note sys_errlist::.).
  20917.  
  20918. Example
  20919. -------
  20920.  
  20921.      if (errno < sys_nerr)
  20922.        printf("Error: %s\n", sys_errlist[errno]);
  20923.  
  20924. 
  20925. File: libc,  Node: sysconf,  Next: system,  Prev: sys_nerr,  Up: Alphabetical List
  20926.  
  20927. sysconf
  20928. =======
  20929.  
  20930. Syntax
  20931. ------
  20932.  
  20933.      #include <unistd.h>
  20934.      
  20935.      long sysconf(int which);
  20936.  
  20937. Description
  20938. -----------
  20939.  
  20940. This function returns various system configuration values, based on
  20941. WHICH:
  20942.  
  20943.        case _SC_ARG_MAX:    return ARG_MAX;
  20944.        case _SC_CHILD_MAX:    return CHILD_MAX;
  20945.        case _SC_CLK_TCK:    return CLOCKS_PER_SEC;
  20946.        case _SC_NGROUPS_MAX:    return NGROUPS_MAX;
  20947.        case _SC_OPEN_MAX:    return 255;
  20948.        case _SC_JOB_CONTROL:    return -1;
  20949.        case _SC_SAVED_IDS:    return -1;
  20950.        case _SC_STREAM_MAX:    return _POSIX_STREAM_MAX;
  20951.        case _SC_TZNAME_MAX:    return TZNAME_MAX;
  20952.        case _SC_VERSION:    return _POSIX_VERSION;
  20953.  
  20954. Return Value
  20955. ------------
  20956.  
  20957. The value.
  20958.  
  20959. 
  20960. File: libc,  Node: system,  Next: tan,  Prev: sysconf,  Up: Alphabetical List
  20961.  
  20962. system
  20963. ======
  20964.  
  20965. Syntax
  20966. ------
  20967.  
  20968.      #include <stdlib.h>
  20969.      
  20970.      int system(const char *cmd);
  20971.  
  20972. Description
  20973. -----------
  20974.  
  20975. This function runs the specified command.  When calling programs
  20976. compiled by djgpp this function will not use command.com and so will
  20977. not be subject to its 126 character limit on command lines.
  20978.  
  20979. Command lines and pipes( i.e., the use of "<", ">", ">>", and "|") will
  20980. be simulated internally in this function.
  20981.  
  20982. Command.com will only be invoked to run commands internal to it, or to
  20983. run batch files.  In these cases, the returned error code will always
  20984. be zero, since command.com always exits with code 0.
  20985.  
  20986. Return Value
  20987. ------------
  20988.  
  20989. The return value of the child process.
  20990.  
  20991. Example
  20992. -------
  20993.  
  20994.      system("cc1plus.exe @cc123456.gp");
  20995.  
  20996. 
  20997. File: libc,  Node: tan,  Next: tanh,  Prev: system,  Up: Alphabetical List
  20998.  
  20999. tan
  21000. ===
  21001.  
  21002. Syntax
  21003. ------
  21004.  
  21005.      #include <math.h>
  21006.      
  21007.      double tan(double x);
  21008.  
  21009. Return Value
  21010. ------------
  21011.  
  21012. The tangent of X.
  21013.  
  21014. 
  21015. File: libc,  Node: tanh,  Next: tell,  Prev: tan,  Up: Alphabetical List
  21016.  
  21017. tanh
  21018. ====
  21019.  
  21020. Syntax
  21021. ------
  21022.  
  21023.      #include <math.h>
  21024.      
  21025.      double tanh(double x);
  21026.  
  21027. Return Value
  21028. ------------
  21029.  
  21030. The hyperbolic tangent of X.
  21031.  
  21032. 
  21033. File: libc,  Node: tell,  Next: telldir,  Prev: tanh,  Up: Alphabetical List
  21034.  
  21035. tell
  21036. ====
  21037.  
  21038. Syntax
  21039. ------
  21040.  
  21041.      #include <io.h>
  21042.      
  21043.      off_t tell(int file);
  21044.  
  21045. Description
  21046. -----------
  21047.  
  21048. This function returns the location of the file pointer for FILE.
  21049.  
  21050. Return Value
  21051. ------------
  21052.  
  21053. The file pointer, or -1 on error.
  21054.  
  21055. Example
  21056. -------
  21057.  
  21058.      off_t q = tell(fd);
  21059.  
  21060. 
  21061. File: libc,  Node: telldir,  Next: textattr,  Prev: tell,  Up: Alphabetical List
  21062.  
  21063. telldir
  21064. =======
  21065.  
  21066. Syntax
  21067. ------
  21068.  
  21069.      #include <dirent.h>
  21070.      
  21071.      long telldir(DIR *dir);
  21072.  
  21073. Description
  21074. -----------
  21075.  
  21076. This function returns a value which indicates the position of the
  21077. pointer in the given directory.  This value is only useful as an
  21078. argument to `seekdir' (*note seekdir::.).
  21079.  
  21080. Return Value
  21081. ------------
  21082.  
  21083. The directory pointer.
  21084.  
  21085. Example
  21086. -------
  21087.  
  21088.      DIR *dir;
  21089.      long q = telldir(dir);
  21090.      do_something();
  21091.      seekdir(dir, q);
  21092.  
  21093. 
  21094. File: libc,  Node: textattr,  Next: textbackground,  Prev: telldir,  Up: Alphabetical List
  21095.  
  21096. textattr
  21097. ========
  21098.  
  21099. Syntax
  21100. ------
  21101.  
  21102.      #include <conio.h>
  21103.      
  21104.      void textattr(int _attr);
  21105.  
  21106. Description
  21107. -----------
  21108.  
  21109. Sets the attribute used for future writes to the screen:
  21110.  
  21111.      ---- XXXX = foreground color
  21112.      -XXX ---- = background color
  21113.      X--- ---- = 1=blink 0=steady
  21114.  
  21115. 
  21116. File: libc,  Node: textbackground,  Next: textcolor,  Prev: textattr,  Up: Alphabetical List
  21117.  
  21118. textbackground
  21119. ==============
  21120.  
  21121. Syntax
  21122. ------
  21123.  
  21124.      #include <conio.h>
  21125.      
  21126.      void textbackground(int _color);
  21127.  
  21128. Description
  21129. -----------
  21130.  
  21131. Sets just the background of the text attribute. *Note textattr::.
  21132.  
  21133. 
  21134. File: libc,  Node: textcolor,  Next: textmode,  Prev: textbackground,  Up: Alphabetical List
  21135.  
  21136. textcolor
  21137. =========
  21138.  
  21139. Syntax
  21140. ------
  21141.  
  21142.      #include <conio.h>
  21143.      
  21144.      void textcolor(int _color);
  21145.  
  21146. Description
  21147. -----------
  21148.  
  21149. Sets just the foreground of the text attribute. *Note textattr::.
  21150.  
  21151. 
  21152. File: libc,  Node: textmode,  Next: time,  Prev: textcolor,  Up: Alphabetical List
  21153.  
  21154. textmode
  21155. ========
  21156.  
  21157. Syntax
  21158. ------
  21159.  
  21160.      #include <conio.h>
  21161.      
  21162.      void textmode(int _mode);
  21163.  
  21164. Description
  21165. -----------
  21166.  
  21167. Sets the text mode of the screen.  _MODE is one of the following:
  21168.  
  21169. `LASTMODE'
  21170.      The text mode which was in effect *before* the last call to
  21171.      `textmode()'.
  21172.  
  21173. `BW40'
  21174.      40-column black and white (on a color screen)
  21175.  
  21176. `C40'
  21177.      40-color color.
  21178.  
  21179. `BW80'
  21180.      80-column black and white (on a color screen)
  21181.  
  21182. `C80'
  21183.      80-column color
  21184.  
  21185. `MONO'
  21186.      The monochrome monitor
  21187.  
  21188. `C4350'
  21189.      80-column, 43- (on EGAs) or 50-row (on VGAs) color
  21190.  
  21191. *Note _set_screen_lines::, for a more versatile method of setting text
  21192. screen dimensions.
  21193.  
  21194. 
  21195. File: libc,  Node: time,  Next: times,  Prev: textmode,  Up: Alphabetical List
  21196.  
  21197. time
  21198. ====
  21199.  
  21200. Syntax
  21201. ------
  21202.  
  21203.      #include <time.h>
  21204.      
  21205.      time_t time(time_t *t);
  21206.  
  21207. Description
  21208. -----------
  21209.  
  21210. If T is not `NULL', the current time is stored in `*t'.
  21211.  
  21212. Return Value
  21213. ------------
  21214.  
  21215. The current time is returned.
  21216.  
  21217. Example
  21218. -------
  21219.  
  21220.      printf("Time is %d\n", time(0));
  21221.  
  21222. 
  21223. File: libc,  Node: times,  Next: tmpfile,  Prev: time,  Up: Alphabetical List
  21224.  
  21225. times
  21226. =====
  21227.  
  21228. Syntax
  21229. ------
  21230.  
  21231.      #include <sys/times.h>
  21232.      
  21233.      clock_t times(struct tms *buf);
  21234.  
  21235. Description
  21236. -----------
  21237.  
  21238. This function returns the number of clock ticks used by the current
  21239. process and all of its children until the moment of call.  The number
  21240. of tics per second is `CLOCKS_PER_SEC', defined on time.h.
  21241.  
  21242. This is the structure in which `times' returns its info:
  21243.  
  21244.      struct  tms {
  21245.        clock_t tms_cstime;
  21246.        clock_t tms_cutime;
  21247.        clock_t tms_stime;
  21248.        clock_t tms_utime;
  21249.      };
  21250.  
  21251. Currently, the elapsed time of the running program is returned in the
  21252. `tms_utime' field, and all other fields return as zero.
  21253.  
  21254. Return Value
  21255. ------------
  21256.  
  21257. The number of elapsed tics since the program started.
  21258.  
  21259. Example
  21260. -------
  21261.  
  21262.      printf("We used %d seconds of elapsed time\n", times(&buf)/CLOCKS_PER_SEC);
  21263.  
  21264. 
  21265. File: libc,  Node: tmpfile,  Next: tmpnam,  Prev: times,  Up: Alphabetical List
  21266.  
  21267. tmpfile
  21268. =======
  21269.  
  21270. Syntax
  21271. ------
  21272.  
  21273.      #include <stdio.h>
  21274.      
  21275.      FILE *tmpfile(void);
  21276.  
  21277. Description
  21278. -----------
  21279.  
  21280. This function opens a temporary file.  It will automatically be removed
  21281. if the file is closed or when the program exits.  The name of the file
  21282. is generated by the same algorithm as described under tmpnam() (*note
  21283. tmpnam::.).
  21284.  
  21285. Return Value
  21286. ------------
  21287.  
  21288. A newly opened file.
  21289.  
  21290. Example
  21291. -------
  21292.  
  21293.      FILE *tmp = tmpfile();
  21294.  
  21295. 
  21296. File: libc,  Node: tmpnam,  Next: toascii,  Prev: tmpfile,  Up: Alphabetical List
  21297.  
  21298. tmpnam
  21299. ======
  21300.  
  21301. Syntax
  21302. ------
  21303.  
  21304.      #include <stdio.h>
  21305.      
  21306.      char *tmpnam(char *s);
  21307.  
  21308. Description
  21309. -----------
  21310.  
  21311. This functions generates a string that is a valid file name and that is
  21312. not the same as the name of an existing file.  A different string is
  21313. guaranteed to be produced each time it is called, up to `TMP_MAX' times
  21314. (`TMP_MAX' is defined on stdio.h).  If `tmpnam' is called more than
  21315. TMP_MAX times, the behavior is implementation-dependent (ours just
  21316. wraps around and tries to reuse the same file names from the beginning).
  21317.  
  21318. This function examines the environment to determine the directory in
  21319. which the temporary file will be opened.  It looks for one of the
  21320. variables `"TMPDIR"', `"TEMP"' and `"TMP"', in that order.  The first
  21321. one which is found in the environment will be used on the assumption
  21322. that it points to a directory.  If neither of the above variables is
  21323. defined, `tmpnam' defaults to the "c:/" directory (which under MS-DOS
  21324. might mean that it fails to generate TMP_MAX unique names, because DOS
  21325. root directories cannot grow beyond certain limits).
  21326.  
  21327. Return Value
  21328. ------------
  21329.  
  21330. If S is a null pointer, `tmpnam' leaves its result in an internal
  21331. static buffer and returns a pointer to that buffer.  If S is not a null
  21332. pointer, it is assumed to point to an array of at least `L_tmpnam'
  21333. characters, and `tmpnam' writes its result in that array and returns a
  21334. pointer to it as its value.
  21335.  
  21336. Example
  21337. -------
  21338.  
  21339.      char buf[L_tmpnam];
  21340.      char *s = tmpname(buf);
  21341.  
  21342. 
  21343. File: libc,  Node: toascii,  Next: tolower,  Prev: tmpnam,  Up: Alphabetical List
  21344.  
  21345. toascii
  21346. =======
  21347.  
  21348. Syntax
  21349. ------
  21350.  
  21351.      #include <ctype.h>
  21352.      
  21353.      int toascii(int c);
  21354.  
  21355. Description
  21356. -----------
  21357.  
  21358. This function strips the high bit of C, forcing it to be an ASCII
  21359. character.
  21360.  
  21361. Return Value
  21362. ------------
  21363.  
  21364. The ASCII character.
  21365.  
  21366. Example
  21367. -------
  21368.  
  21369.      for (i=0; buf[i]; i++)
  21370.        buf[i] = toascii(buf[i]);
  21371.  
  21372. 
  21373. File: libc,  Node: tolower,  Next: toupper,  Prev: toascii,  Up: Alphabetical List
  21374.  
  21375. tolower
  21376. =======
  21377.  
  21378. Syntax
  21379. ------
  21380.  
  21381.      #include <ctype.h>
  21382.      
  21383.      int tolower(int c);
  21384.  
  21385. Description
  21386. -----------
  21387.  
  21388. This function returns C, converting it to lower case if it is upper
  21389. case.  *Note toupper::.
  21390.  
  21391. Return Value
  21392. ------------
  21393.  
  21394. The lower case letter.
  21395.  
  21396. Example
  21397. -------
  21398.  
  21399.      for (i=0; buf[i]; i++)
  21400.        buf[i] = tolower(buf[i]);
  21401.  
  21402. 
  21403. File: libc,  Node: toupper,  Next: _truename,  Prev: tolower,  Up: Alphabetical List
  21404.  
  21405. toupper
  21406. =======
  21407.  
  21408. Syntax
  21409. ------
  21410.  
  21411.      #include <ctype.h>
  21412.      
  21413.      int toupper(int c);
  21414.  
  21415. Description
  21416. -----------
  21417.  
  21418. This function returns C, converting it to upper case if it is lower
  21419. case. *Note tolower::.
  21420.  
  21421. Return Value
  21422. ------------
  21423.  
  21424. The upper case letter.
  21425.  
  21426. Example
  21427. -------
  21428.  
  21429.      for (i=0; buf[i]; i++)
  21430.        buf[i] = toupper(buf[i]);
  21431.  
  21432. 
  21433. File: libc,  Node: _truename,  Next: truncate,  Prev: toupper,  Up: Alphabetical List
  21434.  
  21435. _truename
  21436. =========
  21437.  
  21438. Syntax
  21439. ------
  21440.  
  21441.      #include <sys/stat.h>
  21442.      
  21443.      char * _truename(const char *path, char *true_path);
  21444.  
  21445. Description
  21446. -----------
  21447.  
  21448. Given a PATH of a file, returns in TRUE_PATH its canonicalized
  21449. pathname, with all letters uppercased, default drive and directory made
  21450. explicit, forward slashes converted to backslashes, asterisks converted
  21451. to appropriate number of of question marks, file and directory names
  21452. truncated to 8.3 if necessary, "." and ".." resolved, extra slashes (but
  21453. the last, if present) removed, SUBSTed, JOINed and ASSIGNed drives
  21454. resolved.  Character devices return as "X:/DEVNAME" (note the forward
  21455. slash!), where X is the CURRENT drive and DEVNAME is the device name
  21456. (e.g.  CON).  This is exactly what DOS TRUENAME command does.  See
  21457. Ralph Brown's Interrupt List for more details.
  21458.  
  21459. The named PATH doesn't have to exist, but the drive, if given as part
  21460. of it, should be a legal DOS drive, as this function hits the disk.
  21461.  
  21462. The function will fail if given a PATH which (1) is an empty string; or
  21463. (2) contains only the drive letter (e.g. "c:"); or (3) has leading
  21464. whitespace.  It will also fail if it couldn't allocate memory required
  21465. for its communication with DOS or for TRUE_PATH (see below).
  21466.  
  21467. Upon success, the function will place the result in TRUE_PATH, if
  21468. that's non-NULL; the buffer should be large enough to contain the
  21469. largest possible pathname (PATH_MAX characters).  If TRUE_PATH is a
  21470. NULL pointer, the space to hold the result will be allocated by calling
  21471. *Note malloc::; it is up to the caller to release the buffer by calling
  21472. *Note free::.
  21473.  
  21474. Return Value
  21475. ------------
  21476.  
  21477. The function returns the pointer to the result.  In case of any failure,
  21478. a NULL pointer is returned, and ERRNO is set.
  21479.  
  21480. Example
  21481. -------
  21482.  
  21483.        fprintf(stderr,
  21484.                "True name of %s is %s\n", path, _truename(path, (char *)0));
  21485.  
  21486. 
  21487. File: libc,  Node: truncate,  Next: ttyname,  Prev: _truename,  Up: Alphabetical List
  21488.  
  21489. truncate
  21490. ========
  21491.  
  21492. Syntax
  21493. ------
  21494.  
  21495.      #include <unistd.h>
  21496.      
  21497.      int truncate(const char *file, off_t size);
  21498.  
  21499. Description
  21500. -----------
  21501.  
  21502. This function truncates FILE to SIZE bytes.
  21503.  
  21504. Return Value
  21505. ------------
  21506.  
  21507. Zero on success, nonzero on failure.
  21508.  
  21509. Example
  21510. -------
  21511.  
  21512.      ftruncate("/tmp/data.txt", 400);
  21513.  
  21514. 
  21515. File: libc,  Node: ttyname,  Next: uclock,  Prev: truncate,  Up: Alphabetical List
  21516.  
  21517. ttyname
  21518. =======
  21519.  
  21520. Syntax
  21521. ------
  21522.  
  21523.      #include <unistd.h>
  21524.      
  21525.      char *ttyname(int file);
  21526.  
  21527. Description
  21528. -----------
  21529.  
  21530. Gives the name of the terminal associated with FILE.
  21531.  
  21532. Return Value
  21533. ------------
  21534.  
  21535. Returns "con" if FILE is a device, else `NULL'.
  21536.  
  21537. Example
  21538. -------
  21539.  
  21540.      char *tty = ttyname(0);
  21541.  
  21542. 
  21543. File: libc,  Node: uclock,  Next: umask,  Prev: ttyname,  Up: Alphabetical List
  21544.  
  21545. uclock
  21546. ======
  21547.  
  21548. Syntax
  21549. ------
  21550.  
  21551.      #include <time.h>
  21552.      
  21553.      uclock_t uclock(void);
  21554.  
  21555. Description
  21556. -----------
  21557.  
  21558. This function returns the number of uclock ticks since an arbitrary
  21559. time, actually, since the first call to `uclock', which itself returns
  21560. zero.  The number of tics per second is UCLOCKS_PER_SEC.
  21561.  
  21562. `uclock' is provided for very high-resulution timing.  It is currently
  21563. accurate to better than 1 microsecond (actually about 840 nanoseconds).
  21564. You cannot time across two midnights with this implementation, giving
  21565. a maximum useful period of 48 hours and an effective limit of 24 hours.
  21566. Casting to a 32-bit integer limits its usefulness to about an hour
  21567. before 32 bits will wrap.
  21568.  
  21569. Note that `printf' cannot print a value of type `uclock_t', even though
  21570. it is an integer value, because it is a 64-bit integer.
  21571.  
  21572. Also note that `uclock' reprograms the interval timer in your PC to act
  21573. as a rate generator rather than a square wave generator.  I've had no
  21574. problems running in this mode all the time, but if you notice strange
  21575. things happening with the clock (losing time) after using `uclock',
  21576. check to see if this is the cause of the problem.
  21577.  
  21578. Return Value
  21579. ------------
  21580.  
  21581. The number of tics.
  21582.  
  21583. Example
  21584. -------
  21585.  
  21586.      printf("%d seconds have elapsed\n", (int)(uclock()/UCLOCKS_PER_SEC));
  21587.  
  21588. 
  21589. File: libc,  Node: umask,  Next: uname,  Prev: uclock,  Up: Alphabetical List
  21590.  
  21591. umask
  21592. =====
  21593.  
  21594.      #include <sys/stat.h>
  21595.      
  21596.      mode_t umask(mode_t cmask);
  21597.  
  21598. Description
  21599. -----------
  21600.  
  21601. This function does nothing.  It exists to assist porting.
  21602.  
  21603. 
  21604. File: libc,  Node: uname,  Next: ungetc,  Prev: umask,  Up: Alphabetical List
  21605.  
  21606. uname
  21607. =====
  21608.  
  21609. Syntax
  21610. ------
  21611.  
  21612.      #include <sys/utsname.h>
  21613.      
  21614.      #int uname(struct utsname *u);
  21615.  
  21616. Description
  21617. -----------
  21618.  
  21619. Fills in the structure with information about the system.
  21620.  
  21621.      struct utsname {
  21622.        char machine[9];
  21623.        char nodename[32];
  21624.        char release[9];
  21625.        char sysname[9];
  21626.        char version[9];
  21627.      };
  21628.  
  21629. `machine'
  21630.      "pc"
  21631.  
  21632. `nodename'
  21633.      The name of your PC (if networking is installed), else "pc".
  21634.  
  21635. `release'
  21636.      The minor release of dos.  For example, dos 1.23 would return "23"
  21637.      here.
  21638.  
  21639. `sysname'
  21640.      The flavor of the OS.
  21641.  
  21642. `version'
  21643.      The major release of dos.  For example, dos 1.23 would return "1"
  21644.      here.
  21645.  
  21646. Return Value
  21647. ------------
  21648.  
  21649. Zero on success, else nonzero.
  21650.  
  21651. 
  21652. File: libc,  Node: ungetc,  Next: ungetch,  Prev: uname,  Up: Alphabetical List
  21653.  
  21654. ungetc
  21655. ======
  21656.  
  21657. Syntax
  21658. ------
  21659.  
  21660.      #include <stdio.h>
  21661.      
  21662.      int ungetc(int c, FILE *file);
  21663.  
  21664. Description
  21665. -----------
  21666.  
  21667. This function pushes C back into the FILE.  You can only push back one
  21668. character at a time.
  21669.  
  21670. Return Value
  21671. ------------
  21672.  
  21673. The pushed-back character, or `EOF' on error.
  21674.  
  21675. Example
  21676. -------
  21677.  
  21678.      int q;
  21679.      while (q = getc(stdin) != 'q');
  21680.      ungetc(q);
  21681.  
  21682. 
  21683. File: libc,  Node: ungetch,  Next: unlink,  Prev: ungetc,  Up: Alphabetical List
  21684.  
  21685. ungetch
  21686. =======
  21687.  
  21688. Syntax
  21689. ------
  21690.  
  21691.      #include <conio.h>
  21692.      
  21693.      int ungetch(int);
  21694.  
  21695. Description
  21696. -----------
  21697.  
  21698. Puts a character back, so that *Note getch:: will return it instead of
  21699. actually reading the console.
  21700.  
  21701. Return Value
  21702. ------------
  21703.  
  21704. The charater is returned.
  21705.  
  21706. 
  21707. File: libc,  Node: unlink,  Next: unlock,  Prev: ungetch,  Up: Alphabetical List
  21708.  
  21709. unlink
  21710. ======
  21711.  
  21712. Syntax
  21713. ------
  21714.  
  21715.      #include <unistd.h>
  21716.      
  21717.      int unlink(const char *file);
  21718.  
  21719. Description
  21720. -----------
  21721.  
  21722. This function removes a file from the file system.
  21723.  
  21724. Return Value
  21725. ------------
  21726.  
  21727. Zero on success, nonzero on failure.
  21728.  
  21729. Example
  21730. -------
  21731.  
  21732.      unlink("data.txt");
  21733.  
  21734. 
  21735. File: libc,  Node: unlock,  Next: _use_lfn,  Prev: unlink,  Up: Alphabetical List
  21736.  
  21737. unlock
  21738. ======
  21739.  
  21740. Syntax
  21741. ------
  21742.  
  21743.      #include <io.h>
  21744.      
  21745.      int unlock(int fd, long offset, long length);
  21746.  
  21747. Description
  21748. -----------
  21749.  
  21750. Unlocks a region previously locked by `lock'.
  21751.  
  21752. *Note lock::.
  21753.  
  21754. Return Value
  21755. ------------
  21756.  
  21757. Zero if successful, nonzero if not.
  21758.  
  21759. 
  21760. File: libc,  Node: _use_lfn,  Next: usleep,  Prev: unlock,  Up: Alphabetical List
  21761.  
  21762. _use_lfn
  21763. ========
  21764.  
  21765. Syntax
  21766. ------
  21767.  
  21768.      #include <libc/dosio.h>
  21769.      
  21770.      int _use_lfn(void);
  21771.  
  21772. Description
  21773. -----------
  21774.  
  21775. This function returns a nonzero value if the low level libc routines
  21776. should try to use the Long File Name (LFN) functions provided with
  21777. Windows 95.  This routine can be replaced with one always returning 0
  21778. to disable using long file names.
  21779.  
  21780. Long file names can also be disabled by setting the flag
  21781. _CRT0_FLAG_NO_LFN in _crt0_startup_flags for an image which should not
  21782. allow use of long file names.  Long names can be suppressed at runtime
  21783. on a global basis by setting the environment variable LFN to N, i.e.
  21784. SET LFN=N.  This might be needed if a distribution expected the
  21785. truncation of long file names to 8.3 format to work.  For example, if a
  21786. C source routine included the file exception.h (9 letters) and the file
  21787. was unzipped as exceptio.h, then GCC would not find the file unless the
  21788. environment variable was set.  The environment variable can be set in
  21789. the djgpp.env file to always disable LFN support on any system, or can
  21790. be set in the DOS environment for a short term (single project) basis.
  21791. If you dual boot a system between Windows 95 and DOS, you probably
  21792. should set LFN=n in your djgpp.env file, since long file names would not
  21793. be visable under DOS, and working with the short names under DOS will
  21794. damage the long names when returning to Windows 95.
  21795.  
  21796. Return Value
  21797. ------------
  21798.  
  21799. If LFN APIs are supported and should be used, it returns 1, else 0.
  21800.  
  21801. 
  21802. File: libc,  Node: usleep,  Next: utime,  Prev: _use_lfn,  Up: Alphabetical List
  21803.  
  21804. usleep
  21805. ======
  21806.  
  21807. Syntax
  21808. ------
  21809.  
  21810.      #include <unistd.h>
  21811.      
  21812.      unsigned usleep(unsigned usec);
  21813.  
  21814. Description
  21815. -----------
  21816.  
  21817. This function pauses the program for USEC microseconds.
  21818.  
  21819. Return Value
  21820. ------------
  21821.  
  21822. The number of unslept microseconds (i.e. zero).
  21823.  
  21824. Example
  21825. -------
  21826.  
  21827.      usleep(500000);
  21828.  
  21829. 
  21830. File: libc,  Node: utime,  Next: utimes,  Prev: usleep,  Up: Alphabetical List
  21831.  
  21832. utime
  21833. =====
  21834.  
  21835. Syntax
  21836. ------
  21837.  
  21838.      #include <utime.h>
  21839.      
  21840.      int utime(const char *file, const struct utimbuf *time);
  21841.  
  21842. Description
  21843. -----------
  21844.  
  21845. This function sets the modification timestamp on the FILE.  The new
  21846. time is stored in this structure:
  21847.  
  21848.      struct utimbuf
  21849.      {
  21850.          time_t  actime;  /* access time (unused) */
  21851.          time_t  modtime; /* modification time */
  21852.      };
  21853.  
  21854. Note that, as under DOS a file only has a single timestamp, the
  21855. `actime' field of `struct utimbuf' is ignored by this function, and
  21856. only `modtime' field is used.
  21857.  
  21858. Return Value
  21859. ------------
  21860.  
  21861. Zero for success, nonzero for failure.
  21862.  
  21863. Example
  21864. -------
  21865.  
  21866.      struct utimbuf t;
  21867.      t.modtime = time(0);
  21868.      utime("data.txt", &t);
  21869.  
  21870. 
  21871. File: libc,  Node: utimes,  Next: vfprintf,  Prev: utime,  Up: Alphabetical List
  21872.  
  21873. utimes
  21874. ======
  21875.  
  21876. Syntax
  21877. ------
  21878.  
  21879.      #include <sys/time.h>
  21880.      
  21881.      int utimes(const char *file, struct timeval tvp[2]);
  21882.  
  21883. Description
  21884. -----------
  21885.  
  21886. This function sets the timestamp of the file to `tvp[1].tv_sec'.
  21887.  
  21888. Return Value
  21889. ------------
  21890.  
  21891. Zero on success, nonzero on failure.
  21892.  
  21893. Example
  21894. -------
  21895.  
  21896.      time_t now;
  21897.      struct timeval tvp[2];
  21898.      time(&now);
  21899.      tvp[0].tv_sec = now + 100;
  21900.      utimes("foo.dat", tvp);
  21901.  
  21902. 
  21903. File: libc,  Node: vfprintf,  Next: vprintf,  Prev: utimes,  Up: Alphabetical List
  21904.  
  21905. vfprintf
  21906. ========
  21907.  
  21908. Syntax
  21909. ------
  21910.  
  21911.      #include <stdio.h>
  21912.      #include <stdarg.h>
  21913.      
  21914.      int vfprintf(FILE *file, const char *format, va_list arguments);
  21915.  
  21916. Description
  21917. -----------
  21918.  
  21919. Sends formatted output from the ARGUMENTS to the FILE.  *Note printf::.
  21920.  
  21921. Return Value
  21922. ------------
  21923.  
  21924. The number of characters written.
  21925.  
  21926. Example
  21927. -------
  21928.  
  21929.      void my_errmsg(char *format, ...)
  21930.      {
  21931.        va_list arg;
  21932.      
  21933.        va_start(arg, format);
  21934.        fprintf(stderr, "my_errmsg: ");
  21935.        vfprintf(stderr, format, arg);
  21936.        va_end(arg);
  21937.      }
  21938.  
  21939. 
  21940. File: libc,  Node: vprintf,  Next: vsprintf,  Prev: vfprintf,  Up: Alphabetical List
  21941.  
  21942. vprintf
  21943. =======
  21944.  
  21945. Syntax
  21946. ------
  21947.  
  21948.      #include <stdio.h>
  21949.      #include <stdarg.h>
  21950.      
  21951.      int vprintf(const char *format, va_list arguments);
  21952.  
  21953. Description
  21954. -----------
  21955.  
  21956. Sends formatted output from the ARGUMENTS to `stdout'.  *Note printf::.
  21957. *Note vfprintf::.
  21958.  
  21959. Return Value
  21960. ------------
  21961.  
  21962. The number of characters written.
  21963.  
  21964. 
  21965. File: libc,  Node: vsprintf,  Next: wait,  Prev: vprintf,  Up: Alphabetical List
  21966.  
  21967. vsprintf
  21968. ========
  21969.  
  21970. Syntax
  21971. ------
  21972.  
  21973.      #include <stdio.h>
  21974.      #include <stdarg.h>
  21975.      
  21976.      int vsprintf(char *buffer, const char *format, va_list arguments);
  21977.  
  21978. Description
  21979. -----------
  21980.  
  21981. Sends formatted output from the ARGUMENTS to the BUFFER.  *Note
  21982. printf::. *Note vfprintf::.
  21983.  
  21984. Return Value
  21985. ------------
  21986.  
  21987. The number of characters written.
  21988.  
  21989. 
  21990. File: libc,  Node: wait,  Next: waitpid,  Prev: vsprintf,  Up: Alphabetical List
  21991.  
  21992. wait
  21993. ====
  21994.  
  21995. Syntax
  21996. ------
  21997.  
  21998.      #include <sys/wait.h>
  21999.      
  22000.      pid_t pid = wait(int *status);
  22001.  
  22002. Description
  22003. -----------
  22004.  
  22005. This function causes its caller to delay its execution until a signal
  22006. is received or one of its child processes terminates.  If any child has
  22007. terminated, return is immediate, returning the process ID and its exit
  22008. status, if that's available.  If no children processes were called since
  22009. the last call, then -1 is returned and `errno' is set.
  22010.  
  22011. Return Value
  22012. ------------
  22013.  
  22014. If successful, this function returns the exit status of the child.  If
  22015. there is an error, these functions return -1 and set `errno' to
  22016. indicate the error type.
  22017.  
  22018. Bugs
  22019. ----
  22020.  
  22021. Currently, this function always fails.
  22022.  
  22023. 
  22024. File: libc,  Node: waitpid,  Next: wcstombs,  Prev: wait,  Up: Alphabetical List
  22025.  
  22026. waitpid
  22027. =======
  22028.  
  22029. Syntax
  22030. ------
  22031.  
  22032.      #include <sys/wait.h>
  22033.      
  22034.      pid_t pid = waitpid((pid_t pid, int *status, int options);
  22035.  
  22036. Description
  22037. -----------
  22038.  
  22039. Currently, this function always fails. A -1 is returned and `errno' is
  22040. set to indicate there are no children.
  22041.  
  22042. Return Value
  22043. ------------
  22044.  
  22045. If successful, this function returns the exit status of the child.  If
  22046. there is an error, these functions return -1 and set `errno' to
  22047. indicate the error type.
  22048.  
  22049. Bugs
  22050. ----
  22051.  
  22052. Currently, this function always fails.
  22053.  
  22054. 
  22055. File: libc,  Node: wcstombs,  Next: wctomb,  Prev: waitpid,  Up: Alphabetical List
  22056.  
  22057. wcstombs
  22058. ========
  22059.  
  22060. Syntax
  22061. ------
  22062.  
  22063.      #include <stdlib.h>
  22064.      
  22065.      size_t wcstombs(char *s, const wchar_t *wcs, size_t n);
  22066.  
  22067. Description
  22068. -----------
  22069.  
  22070. Converts a wide character string to a multibyte string.  At most N
  22071. characters are stored.
  22072.  
  22073. Return Value
  22074. ------------
  22075.  
  22076. The number of characters stored.
  22077.  
  22078. Example
  22079. -------
  22080.  
  22081.      int len = wcstombs(buf, wstring, sizeof(buf));
  22082.  
  22083. 
  22084. File: libc,  Node: wctomb,  Next: wherex,  Prev: wcstombs,  Up: Alphabetical List
  22085.  
  22086. wctomb
  22087. ======
  22088.  
  22089. Syntax
  22090. ------
  22091.  
  22092.      #include <stdlib.h>
  22093.      
  22094.      int wctomb(char *s, wchar_t wchar);
  22095.  
  22096. Description
  22097. -----------
  22098.  
  22099. Convert a wide character to a multibyte character.  The string S must
  22100. be at least `MB_LEN_MAX' bytes long.
  22101.  
  22102. Return Value
  22103. ------------
  22104.  
  22105. The number of characters stored.
  22106.  
  22107. Example
  22108. -------
  22109.  
  22110.      char s[MB_LEN_MAX];
  22111.      int mlen = wctomb(s, wc);
  22112.  
  22113. 
  22114. File: libc,  Node: wherex,  Next: wherey,  Prev: wctomb,  Up: Alphabetical List
  22115.  
  22116. wherex
  22117. ======
  22118.  
  22119. Syntax
  22120. ------
  22121.  
  22122.      #include <conio.h>
  22123.      
  22124.      int wherex(void);
  22125.  
  22126. Return Value
  22127. ------------
  22128.  
  22129. The column the cursor is on.  The leftmost column is 1.
  22130.  
  22131. 
  22132. File: libc,  Node: wherey,  Next: window,  Prev: wherex,  Up: Alphabetical List
  22133.  
  22134. wherey
  22135. ======
  22136.  
  22137. Syntax
  22138. ------
  22139.  
  22140.      #include <conio.h>
  22141.      
  22142.      int     wherey(void);
  22143.  
  22144. Return Value
  22145. ------------
  22146.  
  22147. The row the cursor is on.  The topmost row is 1.
  22148.  
  22149. 
  22150. File: libc,  Node: window,  Next: write,  Prev: wherey,  Up: Alphabetical List
  22151.  
  22152. window
  22153. ======
  22154.  
  22155. Syntax
  22156. ------
  22157.  
  22158.      #include <conio.h>
  22159.      
  22160.      void    window(int _left, int _top, int _right, int _bottom);
  22161.  
  22162. Description
  22163. -----------
  22164.  
  22165. Specifies the window on the screen to be used for future output
  22166. requests.  The upper left corner of the physical screen is (1,1).
  22167.  
  22168. 
  22169. File: libc,  Node: write,  Next: _write,  Prev: window,  Up: Alphabetical List
  22170.  
  22171. write
  22172. =====
  22173.  
  22174. Syntax
  22175. ------
  22176.  
  22177.      #include <unistd.h>
  22178.      
  22179.      int write(int file, const void *buffer, unsigned count);
  22180.  
  22181. Description
  22182. -----------
  22183.  
  22184. This function writes COUNT bytes from BUFFER to FILE.  It returns the
  22185. number of bytes actually written.  It will return zero if the disk is
  22186. full, and may return less than COUNT even under valid conditions.
  22187.  
  22188. Note that if FILE is a text file, `write' may write more bytes than it
  22189. reports.
  22190.  
  22191. If COUNT is zero, the function does nothing and returns zero.  Use
  22192. _write if you want to actually ask dos to write zero bytes.
  22193.  
  22194. Return Value
  22195. ------------
  22196.  
  22197. The number of bytes written, zero at EOF, or -1 on error.
  22198.  
  22199. Example
  22200. -------
  22201.  
  22202.      write(fd, "hello", 5);
  22203.  
  22204. 
  22205. File: libc,  Node: _write,  Next: xfree,  Prev: write,  Up: Alphabetical List
  22206.  
  22207. _write
  22208. ======
  22209.  
  22210. Syntax
  22211. ------
  22212.  
  22213.      #include <io.h>
  22214.      
  22215.      ssize_t _write(int fildes, void *buf, size_t nbyte);
  22216.  
  22217. Description
  22218. -----------
  22219.  
  22220. This is a direct connection to the MS-DOS write function call, int
  22221. 0x21, %ah = 0x40.  No conversion is done on the data; it is written as
  22222. raw binary data.
  22223.  
  22224. Return Value
  22225. ------------
  22226.  
  22227. The number of bytes written.
  22228.  
  22229. 
  22230. File: libc,  Node: xfree,  Next: xmalloc,  Prev: _write,  Up: Alphabetical List
  22231.  
  22232. xfree
  22233. =====
  22234.  
  22235. Syntax
  22236. ------
  22237.  
  22238.      #include <stdlib.h>
  22239.      
  22240.      void xfree(void *ptr);
  22241.  
  22242. Description
  22243. -----------
  22244.  
  22245. Frees memory allocated by `xmalloc' (*note xmalloc::.).  This function
  22246. guarantees that a NULL pointer is handled gracefully.
  22247.  
  22248. Example
  22249. -------
  22250.  
  22251.      void *f = xmalloc(100);
  22252.      xfree(f);
  22253.  
  22254. 
  22255. File: libc,  Node: xmalloc,  Next: xrealloc,  Prev: xfree,  Up: Alphabetical List
  22256.  
  22257. xmalloc
  22258. =======
  22259.  
  22260. Syntax
  22261. ------
  22262.  
  22263.      #include <stdlib.h>
  22264.      
  22265.      void *xmalloc(size_t size);
  22266.  
  22267. Description
  22268. -----------
  22269.  
  22270. This function is just like `malloc' (*note malloc::.), except that if
  22271. there is no more memory, it prints an error message and exits.
  22272.  
  22273. Return Value
  22274. ------------
  22275.  
  22276. A pointer to the newly allocated memory.
  22277.  
  22278. Example
  22279. -------
  22280.  
  22281.      char *f = xmalloc(100);
  22282.  
  22283. 
  22284. File: libc,  Node: xrealloc,  Prev: xmalloc,  Up: Alphabetical List
  22285.  
  22286. xrealloc
  22287. ========
  22288.  
  22289. Syntax
  22290. ------
  22291.  
  22292.      #include <stdlib.h>
  22293.      
  22294.      void *xrealloc(void *ptr, size_t size);
  22295.  
  22296. Description
  22297. -----------
  22298.  
  22299. This function is just like `realloc' (*note realloc::.), except that if
  22300. there is no more memory, it prints an error message and exits.  It can
  22301. also properly handle PTR being `NULL'.
  22302.  
  22303. Return Value
  22304. ------------
  22305.  
  22306. A pointer to a possibly new block.
  22307.  
  22308. Example
  22309. -------
  22310.  
  22311.      char *buf;
  22312.      buf = (char *)xrealloc(buf, new_size);
  22313.  
  22314. 
  22315. File: libc,  Node: Index,  Up: Top
  22316.  
  22317. * Menu:
  22318. *Note Alphabetical List::
  22319.  
  22320.  
  22321. 
  22322. Tag Table:
  22323. Node: Top168
  22324. Node: Introduction468
  22325. Node: Functional Categories1674
  22326. Node: bios functions2384
  22327. Node: conio functions2768
  22328. Node: cpu functions3565
  22329. Node: ctype functions4076
  22330. Node: dos functions4410
  22331. Node: dpmi functions5097
  22332. Node: environment functions9044
  22333. Node: file system functions9246
  22334. Node: go32 functions10066
  22335. Node: io functions10469
  22336. Node: locale functions10867
  22337. Node: math functions11134
  22338. Node: memory functions11590
  22339. Node: misc functions12342
  22340. Node: mono functions12707
  22341. Node: posix functions12908
  22342. Node: process functions13109
  22343. Node: random number functions13460
  22344. Node: shell functions13675
  22345. Node: signal functions13863
  22346. Node: sound functions14044
  22347. Node: startup functions14226
  22348. Node: stdio functions14510
  22349. Node: stdlib functions15391
  22350. Node: string functions15563
  22351. Node: time functions16142
  22352. Node: unix functions16536
  22353. Node: Alphabetical List17110
  22354. Node: abort27700
  22355. Node: abs28115
  22356. Node: access28409
  22357. Node: acos29302
  22358. Node: acosh29515
  22359. Node: addmntent29745
  22360. Node: alarm30160
  22361. Node: alloca30755
  22362. Node: asctime31266
  22363. Node: asin31980
  22364. Node: asinh32192
  22365. Node: assert32417
  22366. Node: atan33297
  22367. Node: atan233511
  22368. Node: atanh33786
  22369. Node: atexit34015
  22370. Node: atof34738
  22371. Node: atoi35303
  22372. Node: atol35854
  22373. Node: _atold36409
  22374. Node: bcmp37001
  22375. Node: bcopy37600
  22376. Node: bdos38071
  22377. Node: bdosptr38843
  22378. Node: _bios_disk39969
  22379. Node: _bios_equiplist44767
  22380. Node: _bios_keybrd45973
  22381. Node: _bios_memsize48562
  22382. Node: _bios_printer49023
  22383. Node: _bios_serialcom50333
  22384. Node: _bios_timeofday53197
  22385. Node: bioscom54173
  22386. Node: biosdisk56266
  22387. Node: biosequip58126
  22388. Node: bioskey59457
  22389. Node: biosmemory60308
  22390. Node: biosprint60852
  22391. Node: biostime61632
  22392. Node: brk62104
  22393. Node: bsearch62736
  22394. Node: bzero63986
  22395. Node: calloc64341
  22396. Node: ceil65063
  22397. Node: cfree65310
  22398. Node: cgets65705
  22399. Node: chdir66285
  22400. Node: chmod66905
  22401. Node: _chmod67571
  22402. Node: chown68691
  22403. Node: chsize69084
  22404. Node: _clear8769395
  22405. Node: clearerr69716
  22406. Node: clock70073
  22407. Node: close70590
  22408. Node: _close70999
  22409. Node: closedir71348
  22410. Node: clreol71697
  22411. Node: clrscr71949
  22412. Node: _conio_kbhit72174
  22413. Node: _control8772700
  22414. Node: cos74226
  22415. Node: cosh74434
  22416. Node: cprintf74653
  22417. Node: cputs75139
  22418. Node: creat75452
  22419. Node: _creat76180
  22420. Node: crlf2nl76583
  22421. Node: __crt0_glob_function76936
  22422. Node: __crt0_load_environment_file77652
  22423. Node: __crt0_setup_arguments78305
  22424. Node: _crt0_startup_flags78930
  22425. Node: cscanf83093
  22426. Node: ctime83447
  22427. Node: delay83869
  22428. Node: delline84297
  22429. Node: difftime84563
  22430. Node: disable85053
  22431. Node: div85596
  22432. Node: __djgpp_map_physical_memory86316
  22433. Node: __djgpp_memory_handle87887
  22434. Node: __djgpp_memory_handle_list88523
  22435. Node: __djgpp_nearptr_disable89101
  22436. Node: __djgpp_nearptr_enable89503
  22437. Node: __djgpp_set_page_attributes91116
  22438. Node: _djstat_describe_lossage92424
  22439. Node: _djstat_fail_bits94603
  22440. Node: _djstat_flags97770
  22441. Node: _doprnt99917
  22442. Node: _dos_close100561
  22443. Node: _dos_commit101228
  22444. Node: _dos_creat101811
  22445. Node: _dos_creatnew102948
  22446. Node: _dos_findfirst104096
  22447. Node: _dos_findnext105668
  22448. Node: _dos_getdate106121
  22449. Node: _dos_getdiskfree106880
  22450. Node: _dos_getdrive107871
  22451. Node: _dos_getfileattr108462
  22452. Node: _dos_getftime109876
  22453. Node: _dos_gettime111788
  22454. Node: _dos_lock112496
  22455. Node: _dos_open112867
  22456. Node: _dos_read114402
  22457. Node: _dos_setdate115781
  22458. Node: _dos_setdrive116767
  22459. Node: _dos_setfileattr117509
  22460. Node: _dos_setftime118514
  22461. Node: _dos_settime119979
  22462. Node: _dos_unlock120885
  22463. Node: _dos_write121270
  22464. Node: _doscan122686
  22465. Node: dosexterr123386
  22466. Node: dosmemget129012
  22467. Node: dosmemgetb129883
  22468. Node: dosmemgetl130798
  22469. Node: dosmemgetw131732
  22470. Node: dosmemput132662
  22471. Node: dosmemputb133500
  22472. Node: dosmemputl134389
  22473. Node: dosmemputw135287
  22474. Node: DPMI Overview136191
  22475. Node: DPMI Specification141238
  22476. Node: __dpmi_allocate_dos_memory141573
  22477. Node: __dpmi_allocate_ldt_descriptors142505
  22478. Node: __dpmi_allocate_linear_memory143274
  22479. Node: __dpmi_allocate_memory144055
  22480. Node: __dpmi_allocate_real_mode_callback144678
  22481. Node: __dpmi_allocate_shared_memory145590
  22482. Node: __dpmi_allocate_specific_ldt_descriptor146207
  22483. Node: __dpmi_clear_debug_watchpoint146855
  22484. Node: __dpmi_create_alias_descriptor147464
  22485. Node: __dpmi_discard_page_contents148108
  22486. Node: __dpmi_free_dos_memory148791
  22487. Node: __dpmi_free_ldt_descriptor149459
  22488. Node: __dpmi_free_memory150132
  22489. Node: __dpmi_free_physical_address_mapping150702
  22490. Node: __dpmi_free_real_mode_callback151413
  22491. Node: __dpmi_free_serialization_on_shared_memory152059
  22492. Node: __dpmi_free_shared_memory152722
  22493. Node: __dpmi_get_and_disable_virtual_interrupt_state153338
  22494. Node: __dpmi_get_and_enable_virtual_interrupt_state154033
  22495. Node: __dpmi_get_and_set_virtual_interrupt_state154748
  22496. Node: __dpmi_get_capabilities155551
  22497. Node: __dpmi_get_coprocessor_status156678
  22498. Node: __dpmi_get_descriptor157263
  22499. Node: __dpmi_get_descriptor_access_rights158559
  22500. Node: __dpmi_get_extended_exception_handler_vector_pm159260
  22501. Node: __dpmi_get_extended_exception_handler_vector_rm160021
  22502. Node: __dpmi_get_free_memory_information160775
  22503. Node: __dpmi_get_memory_block_size_and_base161513
  22504. Node: __dpmi_get_memory_information162190
  22505. Node: __dpmi_get_multiple_descriptors162844
  22506. Node: __dpmi_get_page_attributes163797
  22507. Node: __dpmi_get_page_size164548
  22508. Node: __dpmi_get_processor_exception_handler_vector165134
  22509. Node: __dpmi_get_protected_mode_interrupt_vector165889
  22510. Node: __dpmi_get_raw_mode_switch_addr166679
  22511. Node: __dpmi_get_real_mode_interrupt_vector167326
  22512. Node: __dpmi_get_segment_base_address168178
  22513. Node: __dpmi_get_segment_limit168950
  22514. Node: __dpmi_get_selector_increment_value169514
  22515. Node: __dpmi_get_state_of_debug_watchpoint170173
  22516. Node: __dpmi_get_state_save_restore_addr170898
  22517. Node: __dpmi_get_vendor_specific_api_entry_point171569
  22518. Node: __dpmi_get_version172265
  22519. Node: __dpmi_get_virtual_interrupt_state173131
  22520. Node: __dpmi_install_resident_service_provider_callback173752
  22521. Node: __dpmi_int174426
  22522. Node: __dpmi_lock_linear_region175429
  22523. Node: __dpmi_map_conventional_memory_in_memory_block176105
  22524. Node: __dpmi_map_device_in_memory_block176915
  22525. Node: __dpmi_mark_page_as_demand_paging_candidate177728
  22526. Node: __dpmi_mark_real_mode_region_as_pageable178472
  22527. Node: __dpmi_physical_address_mapping179218
  22528. Node: __dpmi_relock_real_mode_region179981
  22529. Node: __dpmi_reset_debug_watchpoint180690
  22530. Node: __dpmi_resize_dos_memory181255
  22531. Node: __dpmi_resize_linear_memory182004
  22532. Node: __dpmi_resize_memory182786
  22533. Node: __dpmi_segment_to_descriptor183515
  22534. Node: __dpmi_serialize_on_shared_memory184279
  22535. Node: __dpmi_set_coprocessor_emulation184911
  22536. Node: __dpmi_set_debug_watchpoint185502
  22537. Node: __dpmi_set_descriptor186217
  22538. Node: __dpmi_set_descriptor_access_rights186846
  22539. Node: __dpmi_set_extended_exception_handler_vector_pm188099
  22540. Node: __dpmi_set_extended_exception_handler_vector_rm188861
  22541. Node: __dpmi_set_multiple_descriptors189614
  22542. Node: __dpmi_set_page_attributes190436
  22543. Node: __dpmi_set_processor_exception_handler_vector191191
  22544. Node: __dpmi_set_protected_mode_interrupt_vector191971
  22545. Node: __dpmi_set_real_mode_interrupt_vector192951
  22546. Node: __dpmi_set_segment_base_address193754
  22547. Node: __dpmi_set_segment_limit194414
  22548. Node: __dpmi_simulate_real_mode_interrupt195248
  22549. Node: __dpmi_simulate_real_mode_procedure_iret196081
  22550. Node: __dpmi_simulate_real_mode_procedure_retf196888
  22551. Node: __dpmi_simulate_real_mode_procedure_retf_stack197735
  22552. Node: __dpmi_terminate_and_stay_resident198910
  22553. Node: __dpmi_unlock_linear_region199568
  22554. Node: __dpmi_yield200193
  22555. Node: dup200723
  22556. Node: dup2201139
  22557. Node: _dxe_load201675
  22558. Node: enable202375
  22559. Node: endgrent202921
  22560. Node: endmntent203283
  22561. Node: endpwent203648
  22562. Node: errno203968
  22563. Node: exec*205838
  22564. Node: _exit206905
  22565. Node: exit207462
  22566. Node: exp207977
  22567. Node: fabs208180
  22568. Node: _far*208465
  22569. Node: fclose210874
  22570. Node: fcntl211262
  22571. Node: fdopen211605
  22572. Node: feof212147
  22573. Node: ferror212555
  22574. Node: fflush212984
  22575. Node: ffs213511
  22576. Node: fgetc213976
  22577. Node: fgetgrent214411
  22578. Node: fgetpos214711
  22579. Node: fgets215115
  22580. Node: File System Extensions215885
  22581. Node: __file_exists217898
  22582. Node: file_tree_walk218607
  22583. Node: filelength221291
  22584. Node: fileno221991
  22585. Node: findfirst222330
  22586. Node: findnext224532
  22587. Node: _fixpath224903
  22588. Node: floor225672
  22589. Node: fmod225920
  22590. Node: _fmode226144
  22591. Node: fnmatch226590
  22592. Node: fnmerge228140
  22593. Node: fnsplit228972
  22594. Node: fopen230238
  22595. Node: fork231806
  22596. Node: fpathconf232085
  22597. Node: _fpreset232530
  22598. Node: fprintf232763
  22599. Node: fpurge233115
  22600. Node: fputc233443
  22601. Node: fputs233825
  22602. Node: fread234255
  22603. Node: free234716
  22604. Node: freopen235108
  22605. Node: frexp235659
  22606. Node: fscanf236103
  22607. Node: fseek236516
  22608. Node: fsetpos237590
  22609. Node: __FSEXT_add_open_handler238022
  22610. Node: __FSEXT_alloc_fd238695
  22611. Node: __FSEXT_call_open_handlers239608
  22612. Node: __FSEXT_get_function240158
  22613. Node: __FSEXT_set_function240859
  22614. Node: fstat241397
  22615. Node: fsync244355
  22616. Node: ftell244736
  22617. Node: ftime245134
  22618. Node: ftruncate245865
  22619. Node: ftw246354
  22620. Node: _fwalk250772
  22621. Node: fwrite251207
  22622. Node: _get_dev_info251687
  22623. Node: _get_dos_version252144
  22624. Node: getc253995
  22625. Node: getcbrk254395
  22626. Node: getch254722
  22627. Node: getchar255173
  22628. Node: getche255467
  22629. Node: getcwd255913
  22630. Node: getdate256627
  22631. Node: getdfree257125
  22632. Node: getdisk257858
  22633. Node: getdtablesize258233
  22634. Node: getegid258558
  22635. Node: getenv258822
  22636. Node: geteuid259258
  22637. Node: getftime259513
  22638. Node: getgid260236
  22639. Node: getgrent260491
  22640. Node: getgrgid261585
  22641. Node: getgrnam261995
  22642. Node: gethostname262411
  22643. Node: getitimer263286
  22644. Node: getkey263796
  22645. Node: getlogin264367
  22646. Node: getlongpass264803
  22647. Node: getmntent265663
  22648. Node: getpagesize269440
  22649. Node: getpass269783
  22650. Node: getpgrp270599
  22651. Node: getpid270909
  22652. Node: getpwent271232
  22653. Node: getpwnam272112
  22654. Node: getpwuid272489
  22655. Node: getrusage272859
  22656. Node: gets273580
  22657. Node: gettext274157
  22658. Node: gettextinfo274499
  22659. Node: gettime275325
  22660. Node: gettimeofday275886
  22661. Node: getuid276680
  22662. Node: getw276930
  22663. Node: getwd277406
  22664. Node: getxkey277809
  22665. Node: glob278371
  22666. Node: globfree279735
  22667. Node: gmtime279987
  22668. Node: _go32_conventional_mem_selector281159
  22669. Node: _go32_dpmi_allocate_dos_memory282254
  22670. Node: _go32_dpmi_allocate_iret_wrapper283465
  22671. Node: _go32_dpmi_allocate_real_mode_callback_iret284664
  22672. Node: _go32_dpmi_allocate_real_mode_callback_retf286430
  22673. Node: _go32_dpmi_chain_protected_mode_interrupt_vector287618
  22674. Node: _go32_dpmi_free_dos_memory288615
  22675. Node: _go32_dpmi_free_iret_wrapper289377
  22676. Node: _go32_dpmi_free_real_mode_callback290023
  22677. Node: _go32_dpmi_get_free_memory_information290726
  22678. Node: _go32_dpmi_get_protected_mode_interrupt_vector292030
  22679. Node: _go32_dpmi_get_real_mode_interrupt_vector292893
  22680. Node: _go32_dpmi_lock_code293598
  22681. Node: _go32_dpmi_lock_data294278
  22682. Node: _go32_dpmi_remaining_physical_memory294894
  22683. Node: _go32_dpmi_remaining_virtual_memory295385
  22684. Node: _go32_dpmi_resize_dos_memory295880
  22685. Node: _go32_dpmi_set_protected_mode_interrupt_vector296831
  22686. Node: _go32_dpmi_set_real_mode_interrupt_vector298723
  22687. Node: _go32_dpmi_simulate_fcall299440
  22688. Node: _go32_dpmi_simulate_fcall_iret300561
  22689. Node: _go32_dpmi_simulate_int301693
  22690. Node: _go32_info_block302826
  22691. Node: _go32_interrupt_stack_size306198
  22692. Node: _go32_my_cs306565
  22693. Node: _go32_my_ds306920
  22694. Node: _go32_my_ss307245
  22695. Node: _go32_rmcb_stack_size307580
  22696. Node: _go32_want_ctrl_break307941
  22697. Node: _go32_was_ctrl_break_hit308856
  22698. Node: gotoxy309636
  22699. Node: gppconio_init309954
  22700. Node: hasmntopt310430
  22701. Node: highvideo310919
  22702. Node: htonl311185
  22703. Node: htons311690
  22704. Node: hypot312188
  22705. Node: inb312526
  22706. Node: index312784
  22707. Node: inp313328
  22708. Node: inportb313589
  22709. Node: inportl314037
  22710. Node: inportsb314503
  22711. Node: inportsl314820
  22712. Node: inportsw315139
  22713. Node: inportw315458
  22714. Node: inpw315910
  22715. Node: insline316178
  22716. Node: insque316482
  22717. Node: int386317071
  22718. Node: int386x317445
  22719. Node: int86317835
  22720. Node: int86x320117
  22721. Node: intdos320788
  22722. Node: intdosx321136
  22723. Node: _is_executable321513
  22724. Node: isalnum323385
  22725. Node: isalpha323718
  22726. Node: isascii324007
  22727. Node: isatty324317
  22728. Node: iscntrl324722
  22729. Node: isdigit325032
  22730. Node: isgraph325319
  22731. Node: islower325672
  22732. Node: isprint325972
  22733. Node: ispunct326321
  22734. Node: isspace326673
  22735. Node: isupper327041
  22736. Node: isxdigit327355
  22737. Node: itoa327702
  22738. Node: kbhit328584
  22739. Node: kill329352
  22740. Node: labs329668
  22741. Node: ldexp329945
  22742. Node: ldiv330243
  22743. Node: link330955
  22744. Node: localeconv331451
  22745. Node: localtime334281
  22746. Node: lock334710
  22747. Node: log335471
  22748. Node: log10335685
  22749. Node: log2335905
  22750. Node: longjmp336125
  22751. Node: lowvideo336894
  22752. Node: lseek337154
  22753. Node: malloc337858
  22754. Node: mblen338433
  22755. Node: mbstowcs339008
  22756. Node: mbtowc339506
  22757. Node: memccpy340090
  22758. Node: memchr341057
  22759. Node: memcmp341546
  22760. Node: memcpy341946
  22761. Node: memmove342321
  22762. Node: memset342869
  22763. Node: mkdir343314
  22764. Node: mkfifo343747
  22765. Node: mknod343971
  22766. Node: mkstemp344195
  22767. Node: mktemp344935
  22768. Node: mktime345697
  22769. Node: modf346158
  22770. Node: modfl346543
  22771. Node: _mono_clear346951
  22772. Node: _mono_printf347204
  22773. Node: _mono_putc347509
  22774. Node: movedata347780
  22775. Node: movedatab349355
  22776. Node: movedatal349690
  22777. Node: movedataw350077
  22778. Node: movetext350463
  22779. Node: mprotect350850
  22780. Node: _my_cs351995
  22781. Node: _my_ds352322
  22782. Node: _my_ss352647
  22783. Node: nice352970
  22784. Node: normvideo353293
  22785. Node: nosound353567
  22786. Node: ntohl353788
  22787. Node: ntohs354288
  22788. Node: open354782
  22789. Node: _open356489
  22790. Node: opendir356886
  22791. Node: outb357990
  22792. Node: outp358266
  22793. Node: outportb358544
  22794. Node: outportl358954
  22795. Node: outportsb359369
  22796. Node: outportsl359679
  22797. Node: outportsw359991
  22798. Node: outportw360304
  22799. Node: outpw360718
  22800. Node: pathconf361004
  22801. Node: pause362275
  22802. Node: pclose362598
  22803. Node: perror363165
  22804. Node: pipe363699
  22805. Node: popen363918
  22806. Node: pow365173
  22807. Node: pow10365395
  22808. Node: pow2365613
  22809. Node: printf365830
  22810. Node: putc369131
  22811. Node: putch369511
  22812. Node: putchar369971
  22813. Node: putenv370348
  22814. Node: puts371176
  22815. Node: puttext371571
  22816. Node: putw371909
  22817. Node: qsort372377
  22818. Node: raise373843
  22819. Node: rand374161
  22820. Node: random374513
  22821. Node: rawclock374796
  22822. Node: read375218
  22823. Node: _read375854
  22824. Node: readdir376279
  22825. Node: realloc377030
  22826. Node: remove377830
  22827. Node: remque378291
  22828. Node: rename378848
  22829. Node: rewind380393
  22830. Node: rewinddir380772
  22831. Node: rindex381212
  22832. Node: rmdir381760
  22833. Node: sbrk382163
  22834. Node: scanf383041
  22835. Node: Screen Variables386367
  22836. Node: ScreenClear387497
  22837. Node: ScreenCols387962
  22838. Node: ScreenGetCursor388622
  22839. Node: ScreenMode389147
  22840. Node: ScreenPutChar389600
  22841. Node: ScreenPutString390237
  22842. Node: ScreenRetrieve390975
  22843. Node: ScreenRows391679
  22844. Node: ScreenSetCursor392243
  22845. Node: ScreenUpdate392759
  22846. Node: ScreenUpdateLine393271
  22847. Node: ScreenVisualBell393754
  22848. Node: searchpath394239
  22849. Node: seekdir394910
  22850. Node: select395531
  22851. Node: _set_screen_lines396573
  22852. Node: setbuf397684
  22853. Node: setbuffer398483
  22854. Node: setcbrk399295
  22855. Node: _setcursortype399672
  22856. Node: setdate400106
  22857. Node: setdisk400485
  22858. Node: setenv400887
  22859. Node: setftime401429
  22860. Node: setgrent402160
  22861. Node: setitimer402563
  22862. Node: setjmp403848
  22863. Node: setlinebuf404623
  22864. Node: setlocale405284
  22865. Node: setmntent406409
  22866. Node: setmode406882
  22867. Node: setpgid407719
  22868. Node: setpwent407997
  22869. Node: settime408347
  22870. Node: settimeofday408725
  22871. Node: setvbuf409174
  22872. Node: siglongjmp410231
  22873. Node: signal410478
  22874. Node: sigsetjmp411271
  22875. Node: sin411514
  22876. Node: sinh411719
  22877. Node: sleep411934
  22878. Node: sound412323
  22879. Node: spawn*412567
  22880. Node: sprintf415402
  22881. Node: sqrt415772
  22882. Node: srandom415989
  22883. Node: sscanf416418
  22884. Node: stat416846
  22885. Node: statfs419946
  22886. Node: _status87421018
  22887. Node: _stklen422124
  22888. Node: stpcpy422537
  22889. Node: strcase422896
  22890. Node: strcasecmp423360
  22891. Node: strcat423836
  22892. Node: strchr424211
  22893. Node: strcmp424715
  22894. Node: strcoll425197
  22895. Node: strcpy425728
  22896. Node: strcspn426071
  22897. Node: strdup426681
  22898. Node: strerror427242
  22899. Node: strftime427717
  22900. Node: stricmp430311
  22901. Node: strlen430773
  22902. Node: strlwr431178
  22903. Node: strncase431571
  22904. Node: strncasecmp432132
  22905. Node: strncat432706
  22906. Node: strncmp433100
  22907. Node: strncpy433626
  22908. Node: strnicmp434014
  22909. Node: strpbrk434572
  22910. Node: strrchr435047
  22911. Node: strsep435492
  22912. Node: strspn436374
  22913. Node: strstr436974
  22914. Node: strtod437398
  22915. Node: strtok437924
  22916. Node: strtol438714
  22917. Node: _strtold439603
  22918. Node: strtoul440150
  22919. Node: strupr440666
  22920. Node: strxfrm441043
  22921. Node: swab441632
  22922. Node: sync442196
  22923. Node: sys_errlist442405
  22924. Node: sys_nerr442771
  22925. Node: sysconf443164
  22926. Node: system443933
  22927. Node: tan444766
  22928. Node: tanh444971
  22929. Node: tell445188
  22930. Node: telldir445545
  22931. Node: textattr446076
  22932. Node: textbackground446452
  22933. Node: textcolor446755
  22934. Node: textmode447043
  22935. Node: time447779
  22936. Node: times448142
  22937. Node: tmpfile449046
  22938. Node: tmpnam449564
  22939. Node: toascii451127
  22940. Node: tolower451531
  22941. Node: toupper451953
  22942. Node: _truename452376
  22943. Node: truncate454323
  22944. Node: ttyname454718
  22945. Node: uclock455100
  22946. Node: umask456473
  22947. Node: uname456718
  22948. Node: ungetc457520
  22949. Node: ungetch457975
  22950. Node: unlink458326
  22951. Node: unlock458692
  22952. Node: _use_lfn459037
  22953. Node: usleep460602
  22954. Node: utime460982
  22955. Node: utimes461777
  22956. Node: vfprintf462280
  22957. Node: vprintf462910
  22958. Node: vsprintf463321
  22959. Node: wait463747
  22960. Node: waitpid464533
  22961. Node: wcstombs465122
  22962. Node: wctomb465582
  22963. Node: wherex466038
  22964. Node: wherey466289
  22965. Node: window466537
  22966. Node: write466903
  22967. Node: _write467680
  22968. Node: xfree468115
  22969. Node: xmalloc468499
  22970. Node: xrealloc468956
  22971. Node: Index469487
  22972. 
  22973. End Tag Table
  22974.